Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I open any record with a combo box????? 1

Status
Not open for further replies.

chubby

Programmer
Apr 28, 2001
278
US
How can I open any form in my database by selecting the report by name from a combo box in a form????
 
You want to open a form by selecting a report in a combo box on your form.

I'm missing something.

I think you want to open another form or report by selecting it from a combo box.

Sure in the After Update event of the combo
--------------------------------------
Private Sub Combo2_AfterUpdate()
'If you have the exact spelling of the forms name you can do this trick

DoCmd.OpenForm Combo2.Text

End Sub
---------------------------

I created a Table with the exact spelling of the forms names
Then I create my combo box to look at that new table.

then I went into the After Update event of the combo and added the above code.

Now you could get fancy and get the spelling of every form in the database using VBA code

here is a snippet from Help

Sub AllOpenForms()
Dim frm As Form, ctl As Control

' Enumerate Forms collection.
For Each frm In Forms
' Print name of form.
Debug.Print frm.Name
' Enumerate Controls collection of each form.
For Each ctl In frm.Controls
' Print name of each control.
Debug.Print ">>>"; ctl.Name
Next ctl
Next frm
End Sub

And add theose names to the table


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
I'm sorry what I meant was how can I open any report in my database by selecting the report by name from a combo box in a form????
 
Thanks, I hope I can re-write this code to make it work for reports...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top