Trouble with command button

M

Mya48

I have a form that customers use to place orders for office supplies. On
this form there's a button to preview the order which opens up a report that
lists their entire order. I also have a command button that says "place
order" and when clicked it sends me an email of the order. The problem I'm
having is that when I go to a different record old or new and press the
"place order" button, it remembers the last order it sent me not what's
currently on the form. How would I fix this? I don't know if it's related to
the code I have on the preview order button:

Private Sub PreviewPlacedOrder_Click()

Dim strReportName As String
Dim strCriteria As String

If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = "Placed Orders"
strCriteria = "[Order Number]= " & Me![Order Number]
'strCriteria = "[Order Number]='" & Me![Order Number] & "'"

DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End If
End Sub

or

if it's the macro for the "place order" button which is simply to email me a
snapshot of the preview order report. I appreciate all your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top