Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap error on Form/SubForm 1

Status
Not open for further replies.

HenryAnthony

Technical User
Feb 14, 2001
358
US
Hi,

If all the required fields in a parent form do not have values and I try to enter a value in the subform, I get the following message:

The field tbl.field cannot contain a Null value because the Required property for this field is set to true. Enter a value in this field.

I understand why this happens but would like to display a more understandable message to users of the database like with error trapping. Can this be done?

I appreciate any help.

Best regards,

Henry
 
You can use the forms on error event. I don't remember wich error it is, but you'll find it by using msgbox DataErr within the routine:

[tt]private sub form_error(dataerr as integer, response as integer)
'msgbox dataerr
if dataerr = <your number> then
msgbox "your custom mesage"
response=acdataerrcontinue ' turn off inbuilt message
end if
end sub[/tt]

Roy-Vidar
 
Roy,

You are soooooooooooooooo smart! I have been trying a variety of methods to accomplish this for about two days. Fortunately I do not make my living from Access. Thank you.

Henry
 
Thank you!

But to see real smartness on this issue, have a look at VBSlammers suggestion here thread705-1008365

Roy-Vidar
 
I will try to wrap my head around that one. That VBSlammer is a maniac! Ya gotta love that guy.

Henry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top