Form from Qry that will set Enabled/Visible

khunter

Registered User.
Local time
Today, 19:30
Joined
Nov 23, 2003
Messages
25
I have a form that is based from a user input querie. I want it to check to see if the value that was entered by the user already exists in the table, then hide certain fields on the form before it opens.

Does anyone have a solid solution to this? I have tried to trap out the querie [Enter Value] and it does not seem to pass it to the form properly.

Something to the effect: IF tblTest.lngID Is NotNull
frmtest.label1 set enabled 0
else
frmtest.label1 set enabled 1


But I cannot seem to put it all together as I am a n00b.
 
You can use the openargs parameter on the DOCMD.Openforms command to pass the value the user entered.

Then in the open event for the form you can see if the value passed from the user exists in the table. If it does, you can then hide (or disable) the appropriate fields.
 
If the visibility is set based on some data value, then put the code in the Current event. This event runs every time the current record pointer moves to a new record.

Code:
If IsNull(Me.SomeField) Then
    Me.SomeField_Lbl.Visible = False
    Me.SomeField.Visible = False
Else
    Me.SomeField_Lbl.Visible = True
    Me.SomeField.Visible = True
End If
 

Users who are viewing this thread

Back
Top Bottom