Clear Field on Error

jibb

Registered User.
Local time
Today, 07:18
Joined
Dec 1, 2011
Messages
93
Hello All,

Probably an obvious one...I have got a form with a couple of dlookups on it, when they return an error it pops the debug message up and if there is a value in the field already it just leaves that value there.
How can I supress the message and clear the field and move on to the next line of code?

Thanks
 
Set the forms On error property to "[Event Procedure]".
Then insert the below code.
Code:
 Private Sub Form_Error(DataErr As Integer, Response As Integer)
  Me.YourFieldName = ""
  Response = acDataErrContinue
End Sub
 
Thanks.

There are 4 fields which have a dlookup that can show the error but I only want to clear the fields that show the error - is that possible?
 
When do the error pop up, by form open/load, when you go to the next record or ...?
 
I'll try explain better...
It's a lookup form for customer pricing - some customers have up to 4 price breaks but if there isn't a price it currently tries to debug and if you just click end it stops any of the rest of the price lookups working.
 
Alex's suggestion is what I'd try:

Nz(DLOOKUP(),"")


If DLookup returns a Null, the Control will be populated with a Zero-Length String.

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom