Checkbox and command button error

kekewong

Registered User.
Local time
Today, 08:36
Joined
Apr 9, 2008
Messages
24
I am trying to perform this kind of task: ok , assume i have already key in all the data and i want to save my data. But Before that, i have to Check a checkbox(Checkbox34) then i only can press a command button(command37) to save my record into database. Then after i press the command button(command37) , i want a string to be display that is ("your have save your data successfully") .After the string display, i wish the checkbox and the command button became uncheck and Greyed-out . I have according the task that i wanted and convert into code, But it seems to got 1 thing is not hapenning that is IT WONT DISPLAY "your have save your data successfully". Any 1 can tell me whats wrong? i have stuck here for half days and i cant figure it out.. Or guilde me please. thank you.The code that i key in is at below:
------------------------------------------------------------------------

Private Sub Check34_AfterUpdate()
If Me.Check34 = True Then
Me.Command37.Enabled = True
Else
Me.Command37.Enabled = False
End If
End Sub


Private Sub Command37_Click()
MsgBox ("your have save your data successfully")
End Sub

Private Sub Check34_LostFocus()
Me.Check34 = False
Me.Command37.Enabled = False
End Sub
 
By the time you have clicked on Command37 Command34 Lost focus will have applied, move that code to after the message box in command 37

Brian
 
huh ? move which code to which code? can say it more detial?
 
Sorry .. i cant solve this problem yet.. Need help ASAP
 
Like So

Code:
Private Sub Command37_Click()
MsgBox ("you have saved your data successfully")
Me.Check34 = False
Me.Command37.Enabled = False
End Sub

And then do away with this
Code:
Private Sub Check34_LostFocus()
Me.Check34 = False
Me.Command37.Enabled = False
End Sub

Brian
 
yup .. i try that before..... BUT still the MSG box wont come out yet..... it just grey-out and uncheck the checkbox only .. i think almost 1 day also cant figure it out yet...
 
Ok took a look see with a little test and that wont work as you cannot disable a command button that has the focus. did you not get that?

I would do it all in the Command37 click.

Code:
Private Sub Command37_Click()
If Me.Check34= True Then
MsgBox ("you have saved your data successfully")
Me.Check34 = False
Else
MsgBox "cannot execute until checkbox checked"

End If
End Sub

Brian
 
wow... i also can do it like that .. PRO brain .. LOL
by the way i got 1 more question to ask Brain. Why u can make the checkbox uncheck after u press the command button? Why not the checkbox is remain check? can explain?
 
So that it is unchecked for the next test.
I assume that this is some sort of input form that will be reused if it is not what you want I will not be upset if you modify the code. :)

Brian
 
wow thanks brain .. n_n i get what u mean anyway , and i have modifyied n_n THanks alot brother.... you save my mind.. lol
 

Users who are viewing this thread

Back
Top Bottom