Conditional Button display

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Please help!!

I have a form with a command button that allows the form
to be closed without saving a record.
The form is opened in 2 different ways, and I would like
to set that button to only be displayed, (useable) when
the form is accessed from the switch board.

I was thinking of using the ON OPEN trigger of the form,
but what is the CODE I need to use to determine where the
form was called from???
 
Bob said:
Please help!!

I have a form with a command button that allows the form
to be closed without saving a record.
The form is opened in 2 different ways, and I would like
to set that button to only be displayed, (useable) when
the form is accessed from the switch board.

I was thinking of using the ON OPEN trigger of the form,
but what is the CODE I need to use to determine where the
form was called from???

In the code that opens the form you can include an OpenArgs value. Then in
the open event...

If Me.OpenArgs = "Whatever" Then
Me.ButtonName.Visible = True
Else
Me.ButtonName.Visible = False
End If

Which can be simplified to...

Me.ButtonName.Visible = (Me.OpenArgs = "Whatever")
 
Thanks Rick
Can you tell me what \/ "Whatever" represents ??
If Me.OpenArgs = "Whatever" Then
 
OK, now if you would please let me know if I have caused
my self any future problems, besides the fact that if i
call to any other forms from that switchboard from
the "EDIT FORM" control, I will only be able to view the
form as this is the code I have used and seems to do the
trick..
Modified the switchboard control as such>>
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument], acNormal, , ,
acReadOnly, , "True"

AND in the FORM_OPEN SUB
Me.CloseNoSave.Visible = Not IsNull(Me.OpenArgs)

Thanks for your help...
I hope I am explaining enough, trying to keep it short...
 
Back
Top