Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot pass reference in txt box when using Terminal services 1

Status
Not open for further replies.

kmac43

Programmer
Jul 3, 2007
1
0
0
US
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.
 
why declare a variant and set that to the control?

why not just:

...
cmd.CommandType = adCmdStoredProc

cmd.parameters("@parameterName") = Me.textBoxName.Value
...

cmd.Execute

debug.print cmd.parameters("@OutPutParameters")
...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top