form data-entry and AfterUpdate event 
Author Message
 form data-entry and AfterUpdate event

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 &
"#"



Wed, 11 Jun 2008 00:15:01 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Monthly Report Expense Data Entry-How to Select Month in Form for data entry to table

2. AfterUpdate Event Data Record Problems

3. Data has changed message - Unbound text box w/ AfterUpdate event Sub

4. Main form AfterUpdate event

5. Update a Subform from Form on AfterUpdate Event

6. Kick Starting AfterUpdate Event in another Form

7. Help with afterupdate event form won't scroll

8. Event chain Form before ,afterupdate

9. Continuous Form AfterUpdate Event

10. Activating the form AfterUpdate event from unbound controls


 
Powered by phpBB® Forum Software © phpBB Group