Are you trying to query MS SQL Server using an Access or VB form? SQL Server can't understand the query. The form is on the client machine. The query runs on the server. They have no connection but through the query string you send. The client must interpret the value in the form and send that to SQL Server. Terry L. Broadbent - DBA
Computing Links:
refers to a Microsoft Access form called form1 which has a control on called champ1
you could try saving the following stored procedure to work in a similar manner
CREATE PROCEDURE [sp_YourProcedure]
@champ1 varchar(255)='%'
as
SELECT champ2 FROM Table2
WHERE champ1 like @champ1
Then by executing the stored procedure you, by default, get all records. If you then supply a parameter then you only get the values corresponding to the value supplied
After creating the stored procedure you could run it from Access by creating a pass-through query. We dynamically create the pass though query though the VBA code on the form. an example is below:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.