Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 04-28-2008, 05:16 AM   #1
vinzz
Newly Registered User
 
Join Date: Apr 2008
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
vinzz is on a distinguished road
On form change record function? Problem hiding/showing boxes on record change

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 )

vinzz is offline   Reply With Quote
Old 04-28-2008, 05:27 AM   #2
doco
Power User
 
doco's Avatar
 
Join Date: Feb 2007
Location: E.Oregon, USA
Posts: 471
Thanks: 23
Thanked 4 Times in 3 Posts
doco is on a distinguished road
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
__________________
Consensus is the lack of leadership
doco is offline   Reply With Quote
Old 04-28-2008, 05:56 AM   #3
vinzz
Newly Registered User
 
Join Date: Apr 2008
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
vinzz is on a distinguished road
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 by vinzz; 04-28-2008 at 06:01 AM.
vinzz is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the active record on the form sahel Forms 1 06-26-2007 08:31 AM
simple record navigation problem viperstingray Forms 3 07-29-2005 08:32 AM
[SOLVED] Form drops edit record; input continues as new record karenk10 General 0 09-22-2004 10:26 AM
Problem with Saveing Record mohammadagul Modules & VBA 3 04-25-2004 08:58 AM
[SOLVED] Form Using a query gives problem while ADDing new record kalyas Forms 2 05-06-2003 10:39 AM




All times are GMT -8. The time now is 01:04 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World