To Add:
Dim Db As DAO.Database
Dim Rst As DAO.Recordset
Set Db = CurrentDb()
Set Rst = Db.OpenRecordset("MyTable")
Rst.Add
Rst!NameOfField1 = <Expression or Value>
Rst!NameOfField2 = <Expression or Value>
Rst!NameOfField3 = <Expression or Value>
....
....
Rst.Update
Rst.Close
Set Rst = Nothing
Set Db = Nothing
To Edit:
Dim Db As DAO.Database
Dim Rst As DAO.Recordset
Set Db = CurrentDb()
Set Rst = Db.OpenRecordset("MyTable")
Rst.FindFirst <Look uo FindFirst method in Help file.
Rst.Edit
Rst!NameOfField1 = <Expression or Value>
Rst!NameOfField2 = <Expression or Value>
Rst!NameOfField3 = <Expression or Value>
....
....
Rst.Update
Rst.Close
Set Rst = Nothing
Set Db = Nothing
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com www.pcdatasheet.com
"Armando" <ar*****@bogusaddress.com> wrote in message
news:HB*******************@news1.epix.net...
This is driving me nuts -
I 'm trying to open a table programmatically, to add or modify records,
and I can't put all the pieces together to make it work in Access 2000. I
have all sorts of apps in 2.0 and 97 to self-plagiarize, but the syntax changes
with every release.
I've tried long enough to get it myself, that I'm ready to "depend on the
kindness of strangers..." Can anyone give me the magic few lines I need
to do this? That is, what workspaces/databases have to be DIM'd, opening the
RS, etc After this, I think I can get the RS.MoveNexts and Updates right.
Thanks one and all,
Armando