On form change record function? Problem hiding/showing boxes on record change (1 Viewer)

vinzz

Registered User
Joined
Apr 24, 2008
Messages
47
Hi,

I'm searching a VB function where i can do the following in my form:

I have a form with 3 checkboxes.
Each checkbox has a memofield hidden underneath it
if the checkbox(KZ_onvol_geg) = true then the memofield (example: Onvoldoende_gegevens) must be visible.
When the checkbox is false it has to hide that memofield
i'made a function that when i check the box as true that it the memofield appears. But when changing to another record, where the checkbox is not checked, it still views the memofield.
How can i add a function that when the form changes it has to check the checkbox each time and if needed hiding or showing the memofield.

this is the simple code i have at the moment:
Code:
Private Sub KZ_onvol_geg_AfterUpdate()
If KZ_onvol_geg = True Then
Me!onvoldoende_gegevens.Visible = True
Else
Me!onvoldoende_gegevens.Visible = False
End If
End Sub
I hope someone can help me with this. A big thanks for the one that finds a solution for this problem :)
(i searched on the net, but found nothing :( )
 

doco

Power User
Joined
Feb 14, 2007
Messages
471
Possibly you could create a routine that sets your checkboxes to what you want as a default then call that routine from the Form_Current() event

Code:
Private Sub Form_Current()

    Call Reset_Controls

End Sub
or something like that
 

vinzz

Registered User
Joined
Apr 24, 2008
Messages
47
Thanks Doco!

Now i have this function, and it works perfect!
Code:
Private Sub Form_Current()
Call Check_Checkbox
End Sub
Private Sub KZ_onjuist_geg_AfterUpdate()
Call Check_Checkbox
End Sub
Private Sub KZ_onvol_geg_AfterUpdate()
Call Check_Checkbox
End Sub
Private Sub Check_Checkbox()
If Me!KZ_onvol_geg = True Then
Me!onvoldoende_gegevens.Visible = True
Else
Me!onvoldoende_gegevens.Visible = False
End If
If Me!KZ_onjuist_geg = True Then
Me!onjuiste_gegevens.Visible = True
Else
Me!onjuiste_gegevens.Visible = False
End If
End Sub
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom