I am using SQL Server as a back end to Access for the first time, and I am having difficulty understanding how the two work together.
Using Access VBA, I am able to open a connection to SQL Server, and I am able to execute a basic stored procedure (which accepts no parameters, just creates a table as a test).
What I don't understand is how to properly use parameters in SQL Server and pass values from Access to stored procedures in SQL Server.
As a basic example, I would like to have:
- a search form where the user selects a customer from a list (which is generated by a Select statement in a SQL Server stored procedure)
- a detail form, whose recordsource is based on a SQL Server stored procedure, where the input parameter is set to the primary key of the customer selected by the user on the search form.
So I guess I really have two questions:
1. How do you set the recordsource of a form to a stored procedure?
2. How do you pass user-selected values from a form to a parameterized stored procedure?
Any help will be much appreciated - thanks in advance!
Using Access VBA, I am able to open a connection to SQL Server, and I am able to execute a basic stored procedure (which accepts no parameters, just creates a table as a test).
What I don't understand is how to properly use parameters in SQL Server and pass values from Access to stored procedures in SQL Server.
As a basic example, I would like to have:
- a search form where the user selects a customer from a list (which is generated by a Select statement in a SQL Server stored procedure)
- a detail form, whose recordsource is based on a SQL Server stored procedure, where the input parameter is set to the primary key of the customer selected by the user on the search form.
So I guess I really have two questions:
1. How do you set the recordsource of a form to a stored procedure?
2. How do you pass user-selected values from a form to a parameterized stored procedure?
Any help will be much appreciated - thanks in advance!