×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

cannot pass reference in txt box when using Terminal services

cannot pass reference in txt box when using Terminal services

cannot pass reference in txt box when using Terminal services

(OP)
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.

RE: cannot pass reference in txt box when using Terminal services

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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close