Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating field from checkbox action on form 1

Status
Not open for further replies.

MontgomeryPete

Instructor
Apr 3, 2004
57
US
I am attempting to update a field when a checkbox is checked. I am using Office 2007 and VBA. This seems like such a simple subroutine, but when I run this code:

Private Sub TimeDispatched_BeforeUpdate(Cancel As Integer)
If Me.Dispatched= True, Me.TimeDispatched=time()
Else Me.Dispached=False, Me.TimeDispatched=Null
Endif
End Sub

The field [TimeDispatched] is not updated.


Any thoughts? Thanks, in advance for your help.

 
Your code isn't VBA (or with few syntax errors ...)
What about this ?
Private Sub TimeDispatched_BeforeUpdate(Cancel As Integer)
If Me!Dispatched = True Then
Me!TimeDispatched = Now
Else
Me!TimeDispatched = Null
End If
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the prompt response. Your code works just fine. Sorry about the VBA confusion--got in too much of a hurry.

Pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top