Command Button - Please help.

G

Guest

I would appreciate any help with this. I have a command button on my main
form that when you click on it it will take you to the main switchboard and
the reports page. This is the what I have now. My Switchboard has two
pages. Page one has forms and button to go to the second page which lists
reports. This only takes me to the main switchboard. If I type
[SwitchboardID] is says there is no such field. I want the command button to
take me to the second page of the switchboard and open reports.

This is the info in the switchboard table for Reports.
SwitchboardID = 2; ItemNumber = 0, ItemText = Reports; Command = 0
How do I write this into the code? Thank you in advance for any help.


Private Sub cmdRPTS_Click()
DoCmd.OpenForm "Switchboard", [ID] = 2

End Sub
 
G

Graham Mandeno

This should work for you:

DoCmd.OpenForm "Switchboard", , , "[SwitchboardID] = 2"

[Note the two extra commas - they are space fillers for two optional
arguments that are not being supplied]
 
G

Guest

Yes - it worked! Thank you much.

Graham Mandeno said:
This should work for you:

DoCmd.OpenForm "Switchboard", , , "[SwitchboardID] = 2"

[Note the two extra commas - they are space fillers for two optional
arguments that are not being supplied]
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

TotallyConfused said:
I would appreciate any help with this. I have a command button on my main
form that when you click on it it will take you to the main switchboard
and
the reports page. This is the what I have now. My Switchboard has two
pages. Page one has forms and button to go to the second page which lists
reports. This only takes me to the main switchboard. If I type
[SwitchboardID] is says there is no such field. I want the command button
to
take me to the second page of the switchboard and open reports.

This is the info in the switchboard table for Reports.
SwitchboardID = 2; ItemNumber = 0, ItemText = Reports; Command = 0
How do I write this into the code? Thank you in advance for any help.


Private Sub cmdRPTS_Click()
DoCmd.OpenForm "Switchboard", [ID] = 2

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top