Larry Brister
asked on
MS Access Linked Tables
I have a MDB Database that uses linked tables to SQL Server and an ODBC COnnection
On the SQL Server, I want to access some stored procedures in the same database.
I want to establish a connection so I can use something like the code below
How do I set cmd.ActiveConnection to look at the itTasks database on the sqlserverDEV\DEV server and instance?
Private Sub FillAssignments()
Dim cmd As New ADODB.Command
cmd.ActiveConnection = Conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "usp_EmployeeAssignments"
cmd.Parameters("@EmployeeN umber") = Nz(Me.Employee_Number, 0)
Set Me.Assignment_Number.Recor dset = cmd.Execute()
End Sub
On the SQL Server, I want to access some stored procedures in the same database.
I want to establish a connection so I can use something like the code below
How do I set cmd.ActiveConnection to look at the itTasks database on the sqlserverDEV\DEV server and instance?
Private Sub FillAssignments()
Dim cmd As New ADODB.Command
cmd.ActiveConnection = Conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "usp_EmployeeAssignments"
cmd.Parameters("@EmployeeN
Set Me.Assignment_Number.Recor
End Sub
Check this. Added to and modified your current code:
Private Sub FillAssignments()
Dim cmd As New ADODB.Command
Dim inParasm As Variant
Dim outParam As Variant 'added---
Dim param As ADODB.Parameter 'added---
Set cmd = New Command 'added ---
cmd.ActiveConnection = CurrentProject.Connection 'modified ---
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "usp_EmployeeAssignments"
cmd.parameters.Append cmd.CreateParameters("inParam",adBSTR,adParameterInput) ' added---
cmd.parameters.Append cmd.CreateParameters("OutParam",adBSTR,adParameterOutput) ' added---
cmd.Parameters("inParam") = Nz(Me.Employee_Number, 0)'modified---
cmd.Execute 'added---
Set Me.Assignment_Number.Recordset = cmd.Parameters("outParam")'modified ---
Set cmd= Nothing 'added---
End Sub
ASKER
hnasf
Your instructions appear incomplete.
chaa
That link was way too generic.
Guys...seems to me I need to run a pass through query...I just can't remember how
Your instructions appear incomplete.
chaa
That link was way too generic.
Guys...seems to me I need to run a pass through query...I just can't remember how
"Your instructions appear incomplete."
I followed your example assuming your using access data project adp
I added few lines, modified others in your code.
If using an access database mdb, or accdb then you can use a passthrough query.
I'll give it a try sometime later if problem not solved.
I followed your example assuming your using access data project adp
I added few lines, modified others in your code.
If using an access database mdb, or accdb then you can use a passthrough query.
I'll give it a try sometime later if problem not solved.
ASKER
hnasr
Looking at my comments they appear impolite.
Not my intention at all and my apologies.
What I meant is that it looks like I need to modify a stored procedure to have an output?
I'm trying to get a multiple row - multiple column recordset back in order to populate a datasheet view form
Looking at my comments they appear impolite.
Not my intention at all and my apologies.
What I meant is that it looks like I need to modify a stored procedure to have an output?
I'm trying to get a multiple row - multiple column recordset back in order to populate a datasheet view form
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks.
This thing was making me crazy
This thing was making me crazy
Welcome!
Basically, you need to set Me.Assignment_Number.Recor