Listbox Value to Code

spcepickle

Registered User.
Local time
Today, 12:47
Joined
Jan 8, 2008
Messages
30
Hi All - I have a form that uses the code: RecordSource = "myquery". I have also have a form that has a nice drop down list box that lists all the different queries I would like to be able to apply to the form. My question is how do I get the list box value into the code.

Thanks!
Amelia
 
If the code is on the form in question:

Me.Recordsource = "'" & Me.YourListBoxName & "'"

Or if on another form:

Forms!YourFormNameHere.Recordsource = "'" & Me.YourListBoxNameHere & "'"

That is, if Me.YourListBoxNameHere returns the name of the query as the bound column.
 
So there are two forms. The request form and the results form.

I have tried putting :Forms!ResultForm.RecordSource = Me.listboxname in the request form
I have also tried: Me.RecordSource = Requestform.listboxname in the result form and neither work.

Any ideas?

Thanks!
Amelia
 
Figured it out!
In the on load code of the Result form I put
Me.RecordSource = Forms!RequestForm.Listboxname

Thanks for the suggestions!

~Amelia
 
Glad you got it working. Sorry I didn't get back to you. I was just too busy at work today to even look in on the forum at all.
 

Users who are viewing this thread

Back
Top Bottom