Help with forms and the switchboard.

  • Thread starter Thread starter James Mckillop
  • Start date Start date
J

James Mckillop

What I would like to do is, using the switchboard, Have
three buttons each opening the same form, but each one
opens that form using a different query for the forms
control source. I know it can be done as I have seen
someone else set it up but I did not see the code he
used. It was explained that you can export the
switchboard to a registry key and then read it back out
in the form you are trying to read and use that to
determine the query to use. But I don't know how yet.
If anyone can help I would be very greatfull.
Thanks

James
 
James, no registry changes needed. Much simpler. Using
the example below, in your code for each button, add this
line after opening the form.

Forms!yourformname.RecordSource = "Customers"

obviously replace yourformname with the actual form, and
where "customers" is replace it with the names of your
query(s)
 
How can you do this when the switchboard form does not
seem to have a line of code for each button? It gets its
stuff from the table and then creates them as it opens.
At least this is what it looks like.
 
You should be able to have a form with as many buttons as
needed. And then the "On Click" property for each button
can have it's own code. From there you can have a
docmd.openform for each button, and then the next line of
code would be what I said previously to set the form's
record source to whatever you would like.
 
The Switchboard is limited to 8 items per switchboard internal section. Thus
if you have a switchboard called Forms, then you can only list eight items
under that switchboard name. If you need to add more than eight items you
choices are:

1. Create sub switchboards under the Forms, Report menu system to
accommodate the extra forms. Note there is a way to bypass the restriction
of eight, but you must know exactly what you are doing and what code you
must change to accommodate this capability. Therefore, I will not sure this
little secret for your own safety.

2. Create your own command buttons on a form to execute your various menu
items. You are not restricted to eight items.
 
Back
Top