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

Problem opening a form based on record selection in a list box. 2

Status
Not open for further replies.

Pire

Technical User
Sep 29, 2002
13
0
0
US
I've searched and can't quite find an answer to my problem. I have a search results form with a listbox in which I would like the user to be able to select one of the records and then open up an existing data entry form baased on the selected record. I assume that since the record pkey exists in the listbox (the listbox is based on results from a query) that I should be able to open the data entry page of that record using the pkey as the identifier but I can't figure out how to get the selected record info to make this link. I'm not a programmer so an answer in lamens terms would be very much appreciated. Thanks-

Trent
 
If you are using the wizard, make sure you have the pkey on both forms. Then create the listbox to "find a record...". Then create your command button to link your forms using the pkey.

If you are doing it in code, use OnClick:
docmd.OpenForm "frm", acNormal, , "[pkey] = " & me.lstPKey
 
Thanks for the help. Unfortunately I still can't get it to work using either method. When I use the wizard to create a button to "open the form and find specific data to display" I can't see any of the fields that are in the listbox. The only thing that comes up is 'List0'. It's like the fields in the listbox aren't associated with the form.

The listbox contains the results from a query. There is not control source identified for the listbox, only a record source. Is this wrong? Thanks.
 
No only the bound column in the lstbox is. Make sure whatever column is pkey in your listbox is the one you have selected in the bound column property.

i.e. if pkey is the 2nd column then bound column = 2
 
THAT'S IT! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top