![]() |
type mismatch
I have a user form with 3 option buttons. the flags are declared in the
declaraitons option button1 click() booleanflag 1= false subproceduresXXXX booleanflag 1 =true option button 2 click() booleanflag 2 =false other subprocedures XXXX booelanflag 2= true option button 3 click() booleanflag 3 = false last procedures booleanflag 3 = true I have a commad button named "okay". If they click all the option then okay it should close but I get a type mismatch here. What should i do? All the subprocess work. Why is it a type mismatch? THANKS, Private Sub cmdOkay_Click() If Flag1 = True & Flag 2 = True & Flag 3= True Then Unload Me End Sub |
type mismatch
1/ ensure you have declared boooleanflag1 to booleanflag3 as boolean
eg: Dim booleanflag1 as boolean 2/remove the spaces ...in all like this booleanflag 1= false to be like booleanflag1 the cmd okay should have 3/ if the name ( not caption ) of your command button is Okay then you sub should be private sub Okay_click() If booleanflag1= true and booleanflag2=true and booleanflag3=true then unload me Else msgbox " All options must be completed before closing" End if End Sub Janis wrote: I have a user form with 3 option buttons. the flags are declared in the declaraitons option button1 click() booleanflag 1= false subproceduresXXXX booleanflag 1 =true option button 2 click() booleanflag 2 =false other subprocedures XXXX booelanflag 2= true option button 3 click() booleanflag 3 = false last procedures booleanflag 3 = true I have a commad button named "okay". If they click all the option then okay it should close but I get a type mismatch here. What should i do? All the subprocess work. Why is it a type mismatch? THANKS, Private Sub cmdOkay_Click() If Flag1 = True & Flag 2 = True & Flag 3= True Then Unload Me End Sub |
type mismatch
Hey steve, thanks, I think I had the syntax
booleanFlag1 = true & boolean flag2 etc. instead of "and" thanks, "stevebriz" wrote: 1/ ensure you have declared boooleanflag1 to booleanflag3 as boolean eg: Dim booleanflag1 as boolean 2/remove the spaces ...in all like this booleanflag 1= false to be like booleanflag1 the cmd okay should have 3/ if the name ( not caption ) of your command button is Okay then you sub should be private sub Okay_click() If booleanflag1= true and booleanflag2=true and booleanflag3=true then unload me Else msgbox " All options must be completed before closing" End if End Sub Janis wrote: I have a user form with 3 option buttons. the flags are declared in the declaraitons option button1 click() booleanflag 1= false subproceduresXXXX booleanflag 1 =true option button 2 click() booleanflag 2 =false other subprocedures XXXX booelanflag 2= true option button 3 click() booleanflag 3 = false last procedures booleanflag 3 = true I have a commad button named "okay". If they click all the option then okay it should close but I get a type mismatch here. What should i do? All the subprocess work. Why is it a type mismatch? THANKS, Private Sub cmdOkay_Click() If Flag1 = True & Flag 2 = True & Flag 3= True Then Unload Me End Sub |
type mismatch
I didn't have the name of the okay button okay either. thanks,
"stevebriz" wrote: 1/ ensure you have declared boooleanflag1 to booleanflag3 as boolean eg: Dim booleanflag1 as boolean 2/remove the spaces ...in all like this booleanflag 1= false to be like booleanflag1 the cmd okay should have 3/ if the name ( not caption ) of your command button is Okay then you sub should be private sub Okay_click() If booleanflag1= true and booleanflag2=true and booleanflag3=true then unload me Else msgbox " All options must be completed before closing" End if End Sub Janis wrote: I have a user form with 3 option buttons. the flags are declared in the declaraitons option button1 click() booleanflag 1= false subproceduresXXXX booleanflag 1 =true option button 2 click() booleanflag 2 =false other subprocedures XXXX booelanflag 2= true option button 3 click() booleanflag 3 = false last procedures booleanflag 3 = true I have a commad button named "okay". If they click all the option then okay it should close but I get a type mismatch here. What should i do? All the subprocess work. Why is it a type mismatch? THANKS, Private Sub cmdOkay_Click() If Flag1 = True & Flag 2 = True & Flag 3= True Then Unload Me End Sub |
All times are GMT +1. The time now is 02:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com