How to feed a sp parameter that populates a listbox

F

Fincastle

Form Main has a control called LoginOffice
There is a button to open another form called CheckMessages
This form is unbound
It has a listbox that has a record source of a store procedure
the stored procedure has a parameter called @Office
How do you feed the sp the value of the Forms!Main!LoginOffice

If it wasn't a listbox but a form you could use the input parameters
property of the form. A listbox does not have that property.

If I write the sql select statement and send it to the listbox will the sql
server run the filter or will it send the table to the client to be filtered?
Thanks
 
R

RoyVidar

Fincastle said:
Form Main has a control called LoginOffice
There is a button to open another form called CheckMessages
This form is unbound
It has a listbox that has a record source of a store procedure
the stored procedure has a parameter called @Office
How do you feed the sp the value of the Forms!Main!LoginOffice

If it wasn't a listbox but a form you could use the input parameters
property of the form. A listbox does not have that property.

If I write the sql select statement and send it to the listbox will
the sql server run the filter or will it send the table to the
client to be filtered? Thanks

So it's an ADP?

In the event you wish to populate this listbox (forms on load event?),
use something like

Me!lstMyList.RowSource = "EXEC NameOfSP " & Forms!Main!LoginOffice

if the parameter is numeric - should it be text, perhaps with single
quotes.

.... NameOfSP '" & Forms!Main!LoginOffice & "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top