I am trying to populate a table in SqlServer from Access using the following:
Private Sub cmdDrvStat_Click()
On Error GoTo Err_cmdDrvStat_Click
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim par0 As Variant
Set par0 = Me.txtDrvID
Dim par1 As Variant
Set par1 = Me.txtDrvName
Dim par2 As Variant
Set par2 = Me.frDrvStat
Set cn = CurrentProject.Connection
Set cmd.ActiveConnection = cn
cmd.CommandText = "GetDriverStat"
cmd.CommandType = adCmdStoredProc
cmd.Execute , Array(par0, par1, par2)
cn.Close
DoCmd.Close
Exit_cmdDrvStat_Click:
Exit Sub
Err_cmdDrvStat_Click:
MsgBox Err.Description
Resume Exit_cmdDrvStat_Click
End Sub
This query runs fine when a user on the LAN runs it. When a user in T services runs it par0 returns 0,par1 returns "InternalObj" and par2 returns the correct information.
The control source for
par0 -Me.txtDrvID = Forms!fStartup.DriverID
par1 -Me.txtDrvName = Forms!fStartup.DrvName
par2 -Me.frDrvStat is an option button on the form.
It seems as if the reference to the original form cannot be followed in T services but I don't know what to do about it.
I have used Access and T-SQL for a few years but this is my first try at an ADO query.
Private Sub cmdDrvStat_Click()
On Error GoTo Err_cmdDrvStat_Click
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim par0 As Variant
Set par0 = Me.txtDrvID
Dim par1 As Variant
Set par1 = Me.txtDrvName
Dim par2 As Variant
Set par2 = Me.frDrvStat
Set cn = CurrentProject.Connection
Set cmd.ActiveConnection = cn
cmd.CommandText = "GetDriverStat"
cmd.CommandType = adCmdStoredProc
cmd.Execute , Array(par0, par1, par2)
cn.Close
DoCmd.Close
Exit_cmdDrvStat_Click:
Exit Sub
Err_cmdDrvStat_Click:
MsgBox Err.Description
Resume Exit_cmdDrvStat_Click
End Sub
This query runs fine when a user on the LAN runs it. When a user in T services runs it par0 returns 0,par1 returns "InternalObj" and par2 returns the correct information.
The control source for
par0 -Me.txtDrvID = Forms!fStartup.DriverID
par1 -Me.txtDrvName = Forms!fStartup.DrvName
par2 -Me.frDrvStat is an option button on the form.
It seems as if the reference to the original form cannot be followed in T services but I don't know what to do about it.
I have used Access and T-SQL for a few years but this is my first try at an ADO query.