B
Brian
I am getting an "Invalid use of null" when performing a DLookup of a record
immediately after inserting it.
'capture date & time
Dim BatchDate As Date
Dim BatchTime As Date
BatchDate = Date
BatchTime = Time
'create invoice batch
Dim strSQL As String
strSQL = "INSERT INTO InvoiceBatch (BatchDate, BatchTime)SELECT Date() AS
BatchDate, Time() AS BatchTime;"
DoCmd.RunSQL strSQL
'capture current batch number to insert into each invoice
BatchIDTemp = DLookup("[BatchID]", "[InvoiceBatch]", "[BatchDate] = #" &
BatchDate & "# and [BatchTime] = #" & BatchTime & "#")
[Lots more code below here]
I get an "Invalid use of Null on the last line (BatchIDTemp = ...), even
though I have verified that the record is correctly inserted into the table
via on the RunSQL statement above. This happens only only on two
workstations. Two other workstations do not have this problem.
Front end is an MDE distributed to each of five WinXP Pro workstations, each
running Access 2003 runtime. Back end is MDB housed on Windows 2003 server.
For what it is worth, before I started debugging to pinpoint the location of
the problem by inserting MsgBoxes at key points, the users were getting a
"3027: Cannot Update. Database or object is read-only error." They were also
receiving a 3027 error on another form that does not write to the back end
(just runs several select SQL statements). However, they had no problem
making any other changes in the database.
The application has been running for eight months prior to this without a
problem. I just rebooted the server to see if there is some network
share/security issue but will not know the effect of that until tomorrow &
thought I should post here in the meantime.
immediately after inserting it.
'capture date & time
Dim BatchDate As Date
Dim BatchTime As Date
BatchDate = Date
BatchTime = Time
'create invoice batch
Dim strSQL As String
strSQL = "INSERT INTO InvoiceBatch (BatchDate, BatchTime)SELECT Date() AS
BatchDate, Time() AS BatchTime;"
DoCmd.RunSQL strSQL
'capture current batch number to insert into each invoice
BatchIDTemp = DLookup("[BatchID]", "[InvoiceBatch]", "[BatchDate] = #" &
BatchDate & "# and [BatchTime] = #" & BatchTime & "#")
[Lots more code below here]
I get an "Invalid use of Null on the last line (BatchIDTemp = ...), even
though I have verified that the record is correctly inserted into the table
via on the RunSQL statement above. This happens only only on two
workstations. Two other workstations do not have this problem.
Front end is an MDE distributed to each of five WinXP Pro workstations, each
running Access 2003 runtime. Back end is MDB housed on Windows 2003 server.
For what it is worth, before I started debugging to pinpoint the location of
the problem by inserting MsgBoxes at key points, the users were getting a
"3027: Cannot Update. Database or object is read-only error." They were also
receiving a 3027 error on another form that does not write to the back end
(just runs several select SQL statements). However, they had no problem
making any other changes in the database.
The application has been running for eight months prior to this without a
problem. I just rebooted the server to see if there is some network
share/security issue but will not know the effect of that until tomorrow &
thought I should post here in the meantime.