Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 command button to run Stored Procedure

Author  Topic 

tmdavis1
Starting Member

6 Posts

Posted - 2008-02-11 : 00:05:58
I am not an Access DBA; I am a SQL 2000/2005 DBA that desperately needs help.

I am running a SQL backend an Access Front End. What I am doing is creating the Access front end to run a stored procedure that I created in SQL 2005. The stored procedure takes the input of an employee id and resets the user. It is a 2 part procedure that first changes the value in one table to False, then the value in the 2nd table to 0.

I have created an Access Form that has a drop-down list of the employee Id's and a "Reset" button. What I would like, is for the Reset button to take in the value of the selected ID from the Form and run the Stored Procedure. I do not know the code to use to get the Event Procedure to run the stored procedure. I have researched online but have found no help with the situation.

Help Please

TMDavis

georgev
Posting Yak Master

122 Posts

Posted - 2008-02-15 : 08:42:20
[CODE]
strSQL = "EXEC sp_configure"

'Instantiate recordset (LATE binding)
Set rs = CreateObject("ADODB.Recordset")

'Open recordset
rs.Open strSQL, strConn, adOpenStatic, adLockReadOnly, adCmdUnspecified

'Loop through recordset
Do While Not rs.EOF
'Print value to immediate window
Debug.Print rs.fields(0)
rs.MoveNext
Loop

'Close recordset
rs.Close
Set rs = Nothing
[/CODE]


George
<3Engaged!
Go to Top of Page

georgev
Posting Yak Master

122 Posts

Posted - 2008-02-15 : 08:42:51
Where strConn is the connection string to your database
www.connectionstrings.com


George
<3Engaged!
Go to Top of Page
   

- Advertisement -