checkbox

tegb

Registered User.
Local time
Today, 07:59
Joined
Feb 14, 2012
Messages
49
I have a checkox called chkdefine & textbox called definedate, I want if chkdefine on the form is checked and Definedate is not null, assign Definedate value to definedate(on the table). However if chkdefine is checked and Definedate is null, I want assign current date to definedate. the below code but it does not seem to be working, please help


If ChkDefine.Value = True And (tblpool![Definedate]) Is Not Null Then
tblpool![Definedate] = Definedate.Value
Else
tblpool![Definedate] = Date
End If
 
Try this:
If Forms!tblpool!chkdefine.Value = True Then
Forms!tblpool!definedate = definedate.Value
Else
Forms!tblpool!definedate = Date
End If
 
I'm having a hard time following your question. When are you running this? How will your program know what record to write this data to? Is your text box bound or unbound?

You have a few options depending on what you're trying to do. You can either run an update query using Currentdb.Execute "SELECT....." or you can open up a recordset and edit the data from there. It really just depends on what you're trying to do.

Most importantly, though, you can't just say: tablename!fieldname = in VBA. That would be why your code is failing.
 

Users who are viewing this thread

Back
Top Bottom