Get data from User using msgbox

  • Thread starter Thread starter Buffyslay_co_uk
  • Start date Start date
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
*************************************************************
 
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.
 
Back
Top