G
Gman063 via AccessMonster.com
I am new to using SQL server as the backend for my database and I am looking
form some help on a DAO add record procedure. I use this procedure allot on
Access DBs but now I have inherited an Access project and need a little help.
I am trying to use the following procedure to add a record to a table:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(“dbo.tblTableNameâ€)
With rs
.AddNew
!Field1 = txtField1
!Field2 = txtField2
.Update
End With
rs.Close
db.Close
This works great in an Access Database but not in the Project. I get the
following error when I try to run the above procedure:
“Runtime error ‘91’;
Object variable or With block variable not setâ€
Any help would be greatly appreciated.
Thanks in advance
form some help on a DAO add record procedure. I use this procedure allot on
Access DBs but now I have inherited an Access project and need a little help.
I am trying to use the following procedure to add a record to a table:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(“dbo.tblTableNameâ€)
With rs
.AddNew
!Field1 = txtField1
!Field2 = txtField2
.Update
End With
rs.Close
db.Close
This works great in an Access Database but not in the Project. I get the
following error when I try to run the above procedure:
“Runtime error ‘91’;
Object variable or With block variable not setâ€
Any help would be greatly appreciated.
Thanks in advance