KARL, you got me to thinkin' and schemin' and I came up with an idea.
Here is what I found:
Private Sub Form_Load()
Dim ctl As Control
Set ctl = Screen.ActiveControl
MsgBox ctl.Name
End Sub
As the button that opens this form is the Option 1 button on the
switchboard, it returns "Option1"
How clever!
So, OP, here is what you can do. First, open the switchboard form in design
view. Not the Switchboard Manager, but select forms, and open the
switchboard form in design view. Now open the Properties dialog and find the
name of the two buttons that open the form. In the example below
Private Sub Form_Load()
Dim ctl As Control
Set ctl = Screen.ActiveControl
If ctl.Name = "Option6" Then 'IsNull Selected
Me.Filter = "[CriteriaField] Is Null"
Else 'Is Not Null Selected
Me.Filter = "[CriteriaField] Is Not Null"
End If
Me.FilterOn = True
Set ctl = Noting
End Sub
Wow! between us, KARL, we is almost genius level <g>
Thanks for the proding.
Hey, John, if you haven't given up and you have any questions about this,
feel free to post back.
--
Dave Hargis, Microsoft Access MVP
KARL DEWEY said:
The form being opened would have no way of knowing which switchboard button
was pressed.
I was thinking of criteria for the query instead.
--
KARL DEWEY
Build a little - Test a little
:
I don't think so.
The proble is that using the SwitchBoard manager, the only thing you can do
to open a form is select OpenForm, and a Form Name.
The form being opened would have no way of knowing which switchboard button
was pressed.
I thought about running a Macro, but there is no option in a macro to send
an OpenArgs to a form.
The problem is Macros and the Switchboard are "crutches" for people who
don't know VBA. Certainly they are valuable tools, but have some sever
limitations.
The only other thing I can think of would be to use a Run Code command, and
write two small functions that pass an OpenArg value to the form in the
OpenForm method, but if the OP is familiar with using VBA, that would be of
no value to him.
--
Dave Hargis, Microsoft Access MVP
:
Dave could you not read which command button was selected?
--
KARL DEWEY
Build a little - Test a little
:
Can't do it from the Switchboard. It is not smart enough.
--
Dave Hargis, Microsoft Access MVP
:
Hello I'm building an App that uses the switchboard functions of access. I
have a form that can be opened from the switchboard. This forms recordset is
a query with the criteria on one field set to "is not null". I would like to
have a second button on the switchboard that would open the same form, but
change the query's criteria to "is null". How would be the best way to
accomplish this?
v/r
john