ListBox question by new Access pgmr

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Please help me with this minor question. I am stumped! I am using
Access2000, Win2000. I have created a table, called catalog, with a key
field of itemNo (autonumber, long integer). I have created a form with a
listBox, called lstCat. I fill the list box when the form is opened. I have
a second form that I want to use to edit the selected record in the catalog
table.

I have placed code in the doubleClick event of the list box to open the
second form that should allow be to edit the selected record. The code is
listed below:

DoCmd.OpenForm "frmSecondForm", , , "itemNo = lstCat"

When I run the app, I get a pop-up box saying Enter Parameter Value. If I
place a value for the itemNo field in this pop-up box, the program continues
to execute with no problem. But I don't want this pop-up box.

Question: why is the itemNo field not being populated with the value from
the list box?
I used Debug.Print, and the value of the listbox lstCat is correct. However,
the itemNo field is not getting the value.

If you can shed some light on this problem, I will be very grateful...
 
Rob said:
Please help me with this minor question. I am stumped! I am using
Access2000, Win2000. I have created a table, called catalog, with a key
field of itemNo (autonumber, long integer). I have created a form with a
listBox, called lstCat. I fill the list box when the form is opened. I have
a second form that I want to use to edit the selected record in the catalog
table.

I have placed code in the doubleClick event of the list box to open the
second form that should allow be to edit the selected record. The code is
listed below:

DoCmd.OpenForm "frmSecondForm", , , "itemNo = lstCat"
"itemNo = " & Me!lstCat if lstCat is a number.
"itemNo = '" & Me!lstCat & "'" if lstCat is a number.
That's single quote, double quote before the first "&" and double quote,
single quote, double quote at the end.
 
Back
Top