M
mtharp
I am entering strings into a bound text box on a continuous form. Sometimes,
the record is not created in the table, and no error is produced. I am using
the AfterUpdate event to print a report containing the record. If the record
is not created, I receive a null error on the DMax() statements, because a
record does not exist for it to return. I can trap this error, but I'd
rather Access just record my data like it is supposed to
See code
below...
Dim serialno As String, varDatestamp As String, varTimestamp As String
serialno = Me.Serial_No.Value
'Determine most recent record by date and time for the serial entered
varDatestamp = DMax("[Datestamp]", "[Processing]", "[Serial No] = """ &
serialno & """")
varTimestamp = DMax("[Timestamp]", "[Processing]", "[Serial No] = """ &
serialno & """ AND [Datestamp] = #" & varDatestamp & "#")
'Make the label - Report is bound to table "[Processing]"
DoCmd.OpenReport "Report Name", acViewNormal, , "[Serial No] = """ &
serialno & """" & _
" AND [Transaction] = 'A_String_identifying_transaction_type' AND " & _
"[Datestamp] = #" & varDatestamp & "# AND [Timestamp] = #" & varTimestamp &
"#"
the record is not created in the table, and no error is produced. I am using
the AfterUpdate event to print a report containing the record. If the record
is not created, I receive a null error on the DMax() statements, because a
record does not exist for it to return. I can trap this error, but I'd
rather Access just record my data like it is supposed to
below...
Dim serialno As String, varDatestamp As String, varTimestamp As String
serialno = Me.Serial_No.Value
'Determine most recent record by date and time for the serial entered
varDatestamp = DMax("[Datestamp]", "[Processing]", "[Serial No] = """ &
serialno & """")
varTimestamp = DMax("[Timestamp]", "[Processing]", "[Serial No] = """ &
serialno & """ AND [Datestamp] = #" & varDatestamp & "#")
'Make the label - Report is bound to table "[Processing]"
DoCmd.OpenReport "Report Name", acViewNormal, , "[Serial No] = """ &
serialno & """" & _
" AND [Transaction] = 'A_String_identifying_transaction_type' AND " & _
"[Datestamp] = #" & varDatestamp & "# AND [Timestamp] = #" & varTimestamp &
"#"