passing a control value to a parameter query

  • Thread starter Tom DeFlavees via AccessMonster.com
  • Start date
T

Tom DeFlavees via AccessMonster.com

using ADP, is it possible to pass the value of a control on a separate form to a function/parameter query ? Or am I right in thinking that SQL cannot properly decode the reference such as VB might. I'm trying to use a combo box to pull a code from a table and then run a query with the box value as the parameter to pass upon pressing a command button. Might it be easier to simply generate the SQL on the fly in VB and pass that ?
 
S

Sylvain Lafontaine

You can open a form and use a parameter from another form if the later is
still open (in memory, but it can be hidden). Use something like this in
the Input Parameters property:

@ComboIdOrganisme int = Forms!f_CalP_Edition!ComboIdOrganisme

If you want to directly open a recordset or execute a query that is not the
recordsource of a form, then the best solution is to use ADODB.

S. L.
 
T

Tom DeFlavees via AccessMonster.com

Thank you very much. Shortly after I posted this I figured out the Input parameter property and how it works. I appreciate the validation however!
 
V

vichet

Where can i find Input Paramenter?

I am not so clear, i try it serveral time, but still fail

thank
 
G

Gerald Aichholzer

vichet said:
Where can i find Input Paramenter?

I am not so clear, i try it serveral time, but still fail

Hi vichet,

InputParameter is unfortunately available for forms only.
If your listbox's (or combobox's) recordsource requires
parameters you'll have to handle this by code. In this
case just use the following code (or similar one) where
needed:

Me.lstEmployees.Recordsource = "EXEC spListEmp " & _
sParameter

If there's more than one parameter you'll have to sepa-
rate them by comma (,) I think (never needed 'til now).

HTH,
Gerald
 

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