parameter from combobox ?

  • Thread starter Thread starter eko007
  • Start date Start date
E

eko007

table name : products
form name : mainform
form control name : button1
form combobox name : combobox1 (binding product)



-------------------------------SP--------------------------
ALTER PROCEDURE queryproduct @whichproduct CHAR(50)
as

SELECT product

FROM products

WHERE products.product = @whichproduct

return

----------------------------------------------------------

button1 click event is..

DoCmd.OpenStoredProcedure "queryproduct"

when I click on the button1, above query is running. but how should I set
the stored procedure to get the parameter from combobox1.
thanks.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

1. In the .adp file, open the stored procedure (sp) in design view.
2. Right-click on the view and select Properties.
3. In the Properties dialog box select the Stored Procedure Parameters
tab.
4. In the Default column Put the full reference name to the ComboBox you
want the parameter to read. E.g.: Forms!myForm!ComboBox1.

When the sp runs it will try to read the value of the ComboBox1 for the
@whichproduct parameter.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQQ6ZgYechKqOuFEgEQINkgCcDYOe3sjOgZQ/OmKaSWi4mp+CCS8AoN/8
B+RDhp64Vb9CFo1dx4YY360Y
=y4Ak
-----END PGP SIGNATURE-----
 
Hi,

Assuming that you want the query results to populate the
Combobox,

Dim sSql as String

sSql = "Exec dbo.queryproduct " & [Forms]![mainform]!
[ComboBox1]

'Remember to make the value of the combobox Sql compatible

ComboBox1.rowsource = sSQL

or if it is the Form Record Source

With Me.RecordSource = sSQL


I hoep this helps
 
Back
Top