Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass param into stored procedure

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
How can I pass a parameter into a stored procedure from some VBA?

I need to have a button on an entry form for file number lookups. It was previously done in a query with a user prompt.

The application is now Access2003 with SQL2005 as a back end and I cannot seem to be able to do the same thing with a view.

Code:
SELECT     Tracking_ID, NetworkLogonID, MachineName, BoxNumber, FileNumber, TrackingDate
FROM         dbo.tblTrackingTable
WHERE     (FileNumber LIKE N'% & [Enter File Number]')



Thanks

John Fuhrman
 
This is not a parameter, but merely a simple filter applied on the view.

Add a text box on the form (txtFileNumber) and a button beside it.
In the button's Click event:

Code:
Dim strFilter as String
strFilter="Where FileNumber Like N'%" & me.txtFileNumber & "%'"
Me.recordsource="Select * from ViewName " & strfilter

If you have an ADP, I would suggest setting the initial recordsource of the form to "Select * from ViewName where 0=1"
In this way the form will be empty when opens and the unnecessary network traffic is minimal.

If you have a stored procedure instead of a view, you must suppply the 'InputParameters' property with the necessary values in their right order.



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top