By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,505 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,505 IT Pros & Developers. It's quick & easy.

Custom Error Message

P: n/a
Again, this is something that I have never done. For my form I have
set the date as the primary key for my record.

I want to create an error message that will pop up and notify the user
that a record for that date has already been created and direct them
to the record that they tried to create a record for.

Example: If somebody tries to add a record with the date of 8/4/07 and
that record exists I want a message box to pop up stating "You tried
to create a duplicate record, would you like to go to that record
now?" with a button for yes / no.

Can this even be done?

All help is greatly appreciated

Sep 12 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Wed, 12 Sep 2007 13:14:08 -0000, lucky33 <ki*******@bellsouth.net>
wrote:

Of course it can. In the date control's AfterUpdate event you can run
some code to test if this date already exists:
if Not IsNull(DLookup("SomeDateField", "SomeTable", "SomeDateField=#"
& Me.SomeDateFieldControl & "#")) Then
Msgbox "Aarrrcccchhhhh, we already have that date!", vbCritical
end if

Note that this code works just as well with linked tables in a split
database (see my previous answer) as with "real" tables.

-Tom.

>Again, this is something that I have never done. For my form I have
set the date as the primary key for my record.

I want to create an error message that will pop up and notify the user
that a record for that date has already been created and direct them
to the record that they tried to create a record for.

Example: If somebody tries to add a record with the date of 8/4/07 and
that record exists I want a message box to pop up stating "You tried
to create a duplicate record, would you like to go to that record
now?" with a button for yes / no.

Can this even be done?

All help is greatly appreciated
Sep 12 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.