how to open a form based on the text value in access 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have 3 forms i create oe table for form names. in another form i create one
combo box if i select the form name and click one button i want to open
that form. how its possible in access 2003. please give the code and sample
program
 
rajeev said:
i have 3 forms i create oe table for form names. in another form i
create one combo box if i select the form name and click one button
i want to open that form. how its possible in access 2003. please
give the code and sample program

The new command button wizard will do all this for you.
 
Hi Rajeev,

Firstly do away with your table with form names unless you are using
aliases. Access has a table which holds forms names already.

Set the RecordSource for your Combobox to:

SELECT MSysObjects.Name FROM MSysObjects WHERE ((MSysObjects.Type)=-32768)
ORDER BY MSysObjects.Name;

Then the click event on your command button to:

Private Sub Commandbuttonname_Click()
On Error GoTo Errtrp
Dim cbo as String
cbo = Me.Comboboxname

DoCmd.OpenForm cbo,acNormal,,,acFormEdit,acWindowNormal

Exittrp:
Exit Sub

Errtrp:
msgbox Err.Number &", " & Err.Description
Resume Exittrp

End Sub

Hope it helps,
Regards,
Nick.
 

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

Back
Top