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!

Enter parameter value 1

Status
Not open for further replies.

joeblow3

Programmer
Jun 9, 2008
21
CA
Hi:

I have two list boxes on a form- one called List12 and the other Program_id. What I want to do is that when the user selects Program_description in List12, the Program_id List box should be populated with Program_id. It does it but only after I get a "Enter Parameter value" prompt and I have to enter the Program_description.
I want this ofcourse done automatically. Both Program_id and Program_description are fields of a Program table.
Here is the code that I have:

Private Sub List12_AfterUpdate()

With Me.[Program_id]

.RowSource = "SELECT [Program_id] " & _
"FROM Program " & _
"WHERE [Program_description]=" & Me.List12

Call .Requery
End With
End Sub

Thanks in advance
 
Why don't you have both Program_ID and Program_Description appear in one listbox?

Anyway, I assume Program_description is text. So in your code:
"WHERE [Program_description]= '" & Me![List12].Value & "'"
 
Thanks.
If I have both Program_id and Program_description in a single listbox how does it know to only take the Program_id part which is required in the form to update a table that the form is being used for.
 
If you use the Listbox wizard to create your listbox, then on the fourth screen you'll see a check next to the statement Hide Key Column. This means the listbox's value is bound to the primary key of the table, in your case Program_ID. So the listbox shows Program_Description which the user selects but the code uses Program_ID.

By the way, if Program_Description is a memo field, the listbox will only show the first 255 characters. You would use the Dlookup function to fill in a textbox to display a full memo field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top