Solved Visible issues (1 Viewer)

LMD2021

New member
Local time
Today, 07:37
Joined
May 29, 2021
Messages
4
I have a form A that I have made some fields that are not visible that is opened by command button 1.
I want to open that same form A and make those fields visible now from command button 2.
I created a Command button 2 with:
Code for a password access. Works, no issues
DoCmd which opens the form, Works, no issues
Now, I want the form to display the fields I previously made not visible.
Field1.visible=true
Field2.visible=true
But my fields do not display on the form.
How do I make the fields visible on the form?
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:37
Joined
Sep 21, 2011
Messages
14,038
Where did you put that code?
 

LMD2021

New member
Local time
Today, 07:37
Joined
May 29, 2021
Messages
4
I put that code on the command button 2. I put the visible code after the DoCmd that opens the form.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:37
Joined
Jan 23, 2006
Messages
15,361
You could try me.requery after your Field2.visible=true
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:37
Joined
Sep 21, 2011
Messages
14,038
As you have it now, that visible code would have to be in the form or refer to the whole formname
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:37
Joined
Feb 28, 2001
Messages
26,996
There are a ton of ways to do this. However, the best way might be to open the form and use something called "OpenArgs" to tell the form which way to open. Then in the Form_Load routine you can set or reset the visibility of whatever you want.


The other alternative is to create a public variable in a general module somewhere, or use a TempVars item to convey a value to tell the form to turn on or off the particular controls.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:37
Joined
Feb 28, 2001
Messages
26,996
Excellent news. Glad I could point the way for you.
 

Users who are viewing this thread

Top Bottom