amfivian
12-06-2007, 01:44 PM
Hi. I'm new at this :banghead:. Can any please tell me how i can modify the following code to use a variable in place 'name' with addNew.
Thanks in anticipation. Andrew
Public Sub addNewRecord(newData As String, myTable As String)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim obj As Object
Set db = CurrentDb()
Set rst = db.OpenRecordset(myTable, dbOpenDynaset)
With rst
.addNew
'!name = newData
.Update
.Bookmark = .LastModified
End With
rst.Close
End Sub
Thanks in anticipation. Andrew
Public Sub addNewRecord(newData As String, myTable As String)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim obj As Object
Set db = CurrentDb()
Set rst = db.OpenRecordset(myTable, dbOpenDynaset)
With rst
.addNew
'!name = newData
.Update
.Bookmark = .LastModified
End With
rst.Close
End Sub