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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I open a form based on a selected record from a list box

Status
Not open for further replies.

phyllisk

Technical User
Jul 23, 2001
11
GB
Hi, I wonder if anyone can help me.
I have created a basic search facility in Access 2000. I enter the surname of the client and the underlying query matches the surname with all clients with the same surname.
The results (ie. Surname, Forename & DOB) are displayed in an unbound list box.
How do I goto a record, located on a different form, of a specific client that is displayed in the list box??
 
I am going to assume that you have three columns in your listbox.

ListBoxName.Column(0) = SurName
ListBoxName.Column(1) = ForeName
ListBoxName.Column(2) = DOB

In the listbox's double click event I would put


DoCmd.OpenForm "YourFromName", , , _
"SurName = '" & ListBoxName.Column(0) & "' AND " _
"ForeName = ' & ListBoxName.Column(1) & "' And " _
"ForeName = ' & ListBoxName.Column(2) & "'"

The OpenForm command has positional parameters. The fourth parm is where you can insert criteria for opening the form.

Good luck... B-)
ljprodev@yahoo.com
ProDev, MS Access Applications
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top