A2K format - BeforeUpdate Question

N

NoodNutt

G'day ppl

Have a form which after the user has completed all data input can invoice
job out.

I have a command button:

Private Sub InvoiceBtn_Click()
Dim InvoiceResp As Integer
InvoiceResp = MsgBox("Are you sure you want to mark this record for
Invoicing ?????", vbYesNo)
If InvoiceResp = vbYes Then
Me.Invoice = 1
Me.WeekNo = Me.DateDel
Else
DoCmd.CancelEvent
End If
End Sub

What I would like to have happen is that before it updates Me.Invoice, it
checks that the [PackStatus]=6 (6=Pack is Delivered).
So if the criteria doesn't match then display message prompt"Record cannot
be Invoiced, Not Delivered off system yet!".

TIA

Mark.
 
T

tina

the CancelEvent action serves no purpose in your code. try

Private Sub InvoiceBtn_Click()

If Not Me!PackStatus = 6 Then
Msgbox "Record cannot be Invoiced, " _
& "Not Delivered off system yet!"
ElseIf MsgBox("Are you sure you want to " _
& "mark this record for Invoicing ?????", _
vbYesNo+vbDefaultButton2) = vbYes Then
Me!Invoice = 1
Me!WeekNo = Me!DateDel
End If

End Sub

hth
 

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