Get data from User using msgbox

B

Buffyslay_co_uk

ok - i'm a blonde so talk slowly!!

i have code that looks at the numbers entered in NET and VAT and GROSS
fields on the form.

if there is no data in GROSS, when you exit VAT, it enters an NET +
VAT in GROSS

Ok so far?

If there is an amount in GROSS - it looks and checks for same amounts
(ie GROSS = NET + VAT)

If this is not correct there is a msgbox saying - oy!! these amounts
are different... check it and which one do you want?

I have got it all ok apart from remembering how to give a 2 option
msgbox to get a value into GROSS.


heres code so far

*************************************************************
Private Sub £VAT_Exit(Cancel As Integer)

If Len(Me.£Gross & "") = O Then
Me.£Gross.Value = Me.£NetTOTAL + Me.£VAT.Value
End If

If Me.£Gross.Value <> Me.£NetTOTAL + Me.£VAT.Value Then
MsgBox "Net and VAT do not add to total in Gross Paid. " &
vbCr & " Gross Paid = £" & Me.£Gross.Value & vbCr & " Net and VAT =
£" & Me.£NetTOTAL + Me.£VAT.Value
End If

End Sub
*************************************************************
 
J

Jeff Boyce

One approach would be something along the lines of (actual syntax may vary):

If vbYes = Msgbox("They don't match -- care to fix it?", vbYesNo,"Your
Msgbox Title") Then
'you could use .SetFocus to put them back to a field they could
change
Else
'what do you want to do if they don't choose to fix it?
End if

This (or your variant on it) would go where your "Msgbox" line is now.
 

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