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

Using ListBox selection in new form

Status
Not open for further replies.

GrahameG

Technical User
May 30, 2001
1
AU
Hi all,

I used to think I knew a little bit about Access but my brain has gone walkabout on this one! I have a Listbox in one form which holds a sub-set of a table based on a variable SQL statement. When the user selects a value from the listbox I want to take the bound column (Primary Key) value and open a new form with the entire table record in that form.

I have actually done this before but no longer remember how (senility is such a bummer) or have access to my old databases.

Would greatly appreciate any help on this.
 
If the new form is bound how about this:

Dim lngKey as long

lngkey = me!listbox.Columns(boundcolumn)

docmd.openform "MyNewform",,, "[Key] = " & lngkey

Give it a try, it should work.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top