M
magmike
The following code runs on Form Current:
----------------------------------------
Private Sub Form_Current()
Dim strSQL As String
Dim db As DAO.Database
Set db = DBEngine(0)(0)
strSQL = "INSERT INTO LastVisitedRecord ( lvCompanyID ) " _
& " VALUES ( " & Me.ID & " ) "
db.Execute strSQL
Set db = Nothing
End Sub
----------------------------------------
However, when creating a new record, I receive an error on the INSERT
INTO statement, because there is no value to insert. How would I
construct an If statement with this code. I've messed with it a bit,
but can't seem to get it to work.
Thanks in advance!
magmike
----------------------------------------
Private Sub Form_Current()
Dim strSQL As String
Dim db As DAO.Database
Set db = DBEngine(0)(0)
strSQL = "INSERT INTO LastVisitedRecord ( lvCompanyID ) " _
& " VALUES ( " & Me.ID & " ) "
db.Execute strSQL
Set db = Nothing
End Sub
----------------------------------------
However, when creating a new record, I receive an error on the INSERT
INTO statement, because there is no value to insert. How would I
construct an If statement with this code. I've messed with it a bit,
but can't seem to get it to work.
Thanks in advance!
magmike