-
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
-
Did you use :
Code:
Set db = New ADODB.Connection
-
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")
-
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...
-
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...