I am attempting to create a switchboard in Access 2003.
This is what I have done so far:
I have manually created a table [ObjectList] in my Access database which includes a column for ObjectID [auto number, primary key], ObjectTitle [form or report title], and ObjectType [Form or Report].
I then manually created a form where I added a Combo Box to the form and a Command button. For the Combo Box, I select "I want the combo box to look up the values in a table or query", select the ObjectTitle and ObjectType fields from the ObjectList table.
The Command Button Wizard walked me through choosing a catagory and Action [I chose Form Operations -> Open a Form].
The Command Button then asks you to choose a form from a list, which I did.
I then chose to "Open the form and show all the records."
I then elected to show text on my Command Button, i.e. "OPEN", and named the Command Button "OpenForm". The Command Button works for the single form I selected during the above process.
Now I want to edit this Command Button so that it opens any of the forms available for selection from the combo box, so I access the Properties on the Command Button -> go to Event tab-> from "On Click" line, I click on the elipsis next to Event Procedure. This opens the code window:
Private Sub OPEN_Click()
On Error GoTo Err_OPEN_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "ADD X"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OPEN_Click:
Exit Sub
Err_OPEN_Click:
MsgBox Err.Description
Resume Exit_OPEN_Click
End Sub
I thought I would be able to edit the command button to open any of the forms or reports listed in the combo box, where the data in the combo box comes from the ObjectList table. Am I wrong, or just in over my head?
Start Free Trial