Error with Macro and VBA in access 2007

John25

New member
Local time
Today, 06:54
Joined
May 2, 2008
Messages
4
I have just updated a database from Access 2000 to Access 2007 and have some difficulties with macros and some VBA code. Each time the macro or code is run Access crashes without an error. This only happens if a new recorded has been added and then printed. If the user goes back in a tries again it works!

What is very strange is that it all work ok in Access 2000. (Please don’t ask why its called email)

Code:
Private Sub email_Click()
On Error GoTo email_Click_Err

DoCmd.OpenReport "Enquiry Form", acNormal, "", "[Enquiry Form Data]![EnquiryRefNo]=[Forms]![Enquirys]![EnquiryRefNo]"

email_Click_Exit:
    Exit Sub

email_Click_Err:
    MsgBox Error$
    Resume email_Click_Exit

End Sub

If I remove the where clause it works again

Can anyone help with this?

John
 
This is just a guess - Maybe you need to save the record first. ?
 

Users who are viewing this thread

Back
Top Bottom