Can you auto(Update) everything in the form when open?

morfusaf

Registered User.
Local time
Today, 11:30
Joined
Apr 24, 2012
Messages
78
Basically, I have a form... on this form I have a check box(LongDistanceTrip), if the checkbox is selected another combo box field (cboPerdiem) becomes visible.

The combo box visible is set to No, orignally... that way its not visible until the person says that the trip is long distance by clicking the check box. This all works fine and dandy by using the afterUpdate() of the checkbox.

My problem is, when I do an update to an event and open an EventID(which populates the form) ... it opens the form populated but since I haven't done any clicking on the checkbox the cboPerdiem is not visible... eventhough the checkbox is Checked....

SO, is there a way to automatically Update every field with exactly what is already in the field, so that the afterUpdate() events happen when form opens?

Hopefully you understand

Form = formCreateNewEvent
Checkbox = LongDistanceTrip
Combo Box = cboPerdiem

Currently I just made the cbo visible all times, and just made it null accordingly.


But I really want to make it invisible if not a long distance trip. I am using the following to make it null. .

Code:
Private Sub LongDistanceTrip_AfterUpdate()
 
   If Me!LongDistanceTrip = False Then
      Me!cboPerdiem.Value = Null
   End If
 
End Sub
 
You need to do the same thing on the Form_Current() event too: So it checks each time a record is displayed and each time the checkbox is updated.

And the code just needs to be:

Code:
Private Sub LongDistanceTrip_AfterUpdate()
   Me!cboPerdiem.Visible = Nz(Me!LongDistanceTrip,False)
End Sub

Private Sub Form_Current()
   Me!cboPerdiem.Visible = Nz(Me!LongDistanceTrip,False)
End Sub
 

Users who are viewing this thread

Back
Top Bottom