Results 1 to 5 of 5

Thread: ado for dsn

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98

    ado for dsn

    Here is my line of code:

    db.Open "FILEDSN=\TestTime.dsn;" & "Uid=admin;" & "Pwd=test;"

    SQL = "Select * from Times"
    rs.Open SQL, db, adOpenStatic, adLockOptimistic
    rs.MoveLast
    rs.AddNew
    rs![Assignment] = lblAssignment.Caption
    rs![DatePerformed] = datPerformed.Value
    rs![RegularRate] = cboReg.Text
    rs![OvertimeRate] = cboOT.Text
    rs![Sick] = cboSick.Text
    rs![GainTime] = cboBank.Text
    rs![UsedTime] = cboOwed.Text
    rs![WorkPerformed] = txtDescription.Text
    rs![WorkArea] = cboLocation.Text
    rs.Update
    DoEvents
    rs.Close


    I get the error message: Run time error 91 Object Variable or With Block Variable Not Set


    Perhaps there is ann error in my string:
    db.Open "FILEDSN=\TestTime.dsn;" & "Uid=admin;" & "Pwd=test;"

    Can someone correct my error please?

    Stevie

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Did you use :
    Code:
    Set db = New ADODB.Connection
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    are you setting db to a connection object and rs to a recordset object?

    Set db = server.createobject("ADODB.Connection")
    Set rs = server.createobject("ADODB.Recordset")
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98
    I tried what you have mentioned and I get the following error on this line:

    Set db = New ADODB.Connection
    Set rs = New ADODB.Recordset


    db.Open "FILEDSN=\TestTime;" & "Uid=admin;" & "Pwd=test;"

    My mdb is located on a server. Is there any way of accessing the dsn without using a drive letter?

    The error I encountered is:

    General error Invalid File dsn'\TestTime'

    Help is appreciated...

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    98
    I tried this as well:

    DSNtemp = "DRIVER={Microsoft Access Driver (*.mdb)};"
    DSNtemp = DSNtemp & "TestTime=" & server.mappath("../time/test.mdb") & ";pwd=test;"
    conn.Open DSNtemp, 1, 3


    Maybe someone can help me straiten this up:
    My dsn is TestTime and it is located on an ip address\folder and the name of the mdb is Test...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width