I am trying to create a procedure with a parameter in SQL Server 2008 and use an unbound textbox to get the result as the Control Source in Access 2010 (Access 2000 – 2003 file format .mdb).
I originally had a dlookup as the control source of the textbox, but it’s too slow.
How can I call the send the parameter from the textbox to the linked stored procedure?
I’m unsure whether this suggestion will be adequate since DLookup is too slow. You might consider showing us your DLookup statement and tell us about the fields it references and their indexes.
Anyway, I think you could use ADO to fetch a result from your SQL Server stored procedure. Here is a simplified example of one I’ve used to fetch the result of an sp in SQL Server Express.
You could build an EXEC statement with value of your parameter. Say it’s a numeric value in a text box named txtParam:
Or if it’s a string, add single quotes in the EXEC:
Instead of Debug.Print, store the value to your text box destination.
Also, I used ODBC for the connection string. You may prefer OLEDB.