Question : Data not current when printing form

I have a form in an Access 2003 database that permits a user to edit a record (and on the same form push a button to print out a record).  After making  a change to the record, sometimes the data on the report doesn't reflect the most recent changes made by the user.

Here is some code I've added to make sure the form is current but it doesn't always seem to help.

What am I doing wrong?
Code Snippet:
1:
2:
3:
4:
5:
6:
If Me.Dirty Then
   RunCommand acCmdSaveRecord
   DBEngine.Idle
End If

DoCmd.OpenReport "rTraveler", acViewPrint, , "(((tMain.TrayNo) Like [forms]![FMain]![TrayNo]))"

Answer : Data not current when printing form

change this

If Me.Dirty Then
   RunCommand acCmdSaveRecord
   DBEngine.Idle
End If

to

If Me.Dirty Then me.dirty=false
Random Solutions  
 
programming4us programming4us