goaway1234
Programmer
In an application that I just migrated from Access 97 to 2003, I have a form that creates a new record when it is opened, and then sets the RecordSource of the form to just that record. Here is the code that is generating the error.
In this code, lngActionID is a private class variable that is used later, and ActionID is an Auto Number field that is the primary key of tblActions. Whenever the assignment 'lngActionID = rst![ActionID]' is made, the user will sometimes get error 2427 "You entered an expression with no value."
The error doesn't happen every time the code is run, and it didn't ever happen in Access 97. Anybody have an idea of what is going on here?
Code:
Set rst = CurrentDb.OpenRecordset("tblActions", dbOpenDynaset)
rst.AddNew
rst![RootID] = lngRootID
lngActionID = rst![ActionID]
rst.Update
rst.Close
In this code, lngActionID is a private class variable that is used later, and ActionID is an Auto Number field that is the primary key of tblActions. Whenever the assignment 'lngActionID = rst![ActionID]' is made, the user will sometimes get error 2427 "You entered an expression with no value."
The error doesn't happen every time the code is run, and it didn't ever happen in Access 97. Anybody have an idea of what is going on here?