Msg box based on currency over 1 million

Flynners

Registered User.
Local time
Yesterday, 17:46
Joined
Mar 1, 2012
Messages
29
Hello
I have an beforeupdate event on a date field (tenderclosingdate) to check some criteria. If the date entered does not meet that criteria then it should give error msg and cancel the update.

The probelm is with one of the conditions. It is a currency field. I want to give a message if certain conditions are met and the currency is greater than or equal to 20,000.

The message works if the estimated cost is between 20k and 999,999. If my estimated cost is 1 million or over the beforeupdate event does not work. (it allows date to be entered without msg or cancel event)
This is the only condition I have coded yet so it is not overruled by a later condition.

In English I want it to prompt me if the date I enter is less than 52 days after the advert date, its open (id =2) and its for "services/goods" and the cost is greater than or equal to 20,000.

I have access2007 with sql2005 backend.
my code is:

If Me.TenderClosingDate < (Me.AdvertisedDate + 52) And Me.ProcedureID = "2" And Me.TenderType = "Services/Goods" And Me.EstimatedCost >= "200000" Then
MsgBox "This is an OPEN tender for GOODS/SERVICES, with estimated value of over €200,000." & vbCrLf & _
"Tender Closing Date must be at least 52 days after the advertising date." _
, vbExclamation, "Tender Closing Date"
DoCmd.CancelEvent
End If

I have tried a few different variations of 20,000 (2 decimal places, with comas, with currency symbol)
Do i need to specify that me.estimatedcost is currency even though in the table design it is currency field. If so what is the correct syntax i should use. Im learning vb as i go so forgive my ignorance

thanks
 
For a numeric field there should not be quotes around the value. Try taking those out first.
 
how embarrassingly simple when you know how:rolleyes:
that sorted me, thanks very much
 

Users who are viewing this thread

Back
Top Bottom