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

How to Open Form and Record of a Name Selected from A Listbox?

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
I would like to open a patients file form from a listbox. I have tried several things. The best I can acheive is opening the form with a blank record. Here's my code on the dbl click event of the list box:

Private Sub List45_DblClick(Cancel As Integer)
Dim strCriteria As String
strCriteria = "[QME/AME Information]![lastname]=[Forms]![QME/AME Information]![lastname]"
DoCmd.OpenForm "QME/AME Information", acNormal, , strCriteria
End Sub
 
the form opens blank because you are not refering to the control properly
need to refer to the value being returned by the listbox
strCriteria = "[QME/AME Information]![lastname]= '" & me.list45.selected.value & "'"

or if the value is in a textbox named lastname
then this should do it

strCriteria = "[QME/AME Information]![lastname]= '" &[Forms]![QME/AME Information]![lastname] &"'"
 
Thanks Brain, I am trying that method and not having any luck. The listbox shows the lastnames but will not select the name and move to their record. It still opens to the first record. Any ideas?
 
Hi.
Make sure that you have the form property "Data entry" set to "no." If it's yes you'll never find your records.
Gus Brunston :cool: An old PICKer, using Access2000
gustrel@aol.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top