Open my form at specific record

  • Thread starter Thread starter trawets
  • Start date Start date
T

trawets

Hi
I had asked before about how to make a value of a combo box depend on
another, I received good information on what and how to do it, my
question now is how do open a form from the second combo box at the
chosen record.
What I have now is a form "find contact" which has two combo boxes
where I can choose a company and then a name from that company from my
command button I can run the query which find thew chosen entry but I
would like to open the "contacts" form at the specific entry.
I have searched and have seen a few suggestion but its difficult
finding the best solution and some seem quite complicated

Thanks in anticipation
 
trawets said:
Hi
I had asked before about how to make a value of a combo box depend on
another, I received good information on what and how to do it, my
question now is how do open a form from the second combo box at the
chosen record.
What I have now is a form "find contact" which has two combo boxes
where I can choose a company and then a name from that company from my
command button I can run the query which find thew chosen entry but I
would like to open the "contacts" form at the specific entry.
I have searched and have seen a few suggestion but its difficult
finding the best solution and some seem quite complicated

Thanks in anticipation


The help topic for the OpenForm method gives the following example ...

DoCmd.OpenForm "Employees", , ,"LastName = 'King'"

You just need to change the form name ("Employees") to the name of the form
you want to open, and the "LastName = 'King'" bit to refer to your field and
control names. For example if your field was named "ContactID" and your
combo box was named cboContactID then the code would look something like
this ...

DoCmd.OpenForm "Contacts", , ,"ContactID = " & Me.cboContactID

If the field is a text field, then you need quotes around the value as in
the help topic example ....

DoCmd.OpenForm "Contacts", , ,"ContactID = '" & Me.cboContactID & "'"

That's a single quote followed by a double quote after the "=" symbol, and a
single quote between two double quotes at the end.

If the field is a numeric field, you don't need the quotes.
 

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

Similar Threads

Open form at specific record 6
combo box filter 1
Open main and sub form blank 1
combo box locked 4
Combo Box 3
Change displayed combo box value using VBA 4
Tabbing produces next record in form 3
Record search 1

Back
Top