Warning Msgbox, OK/Cancel

K

Kirstie Adam

All,

I have a client info form, and the customers name is entered into two
fields, [FirstName] and [Surname].
I also have a expression [Title]&" "&[FirstName]&" "&[LastName] and the top
of the form to show their complete name, eg. "Miss Jemima Lane".

However, we have been getting lots of duplicates entered, some of them
intentionally (some clients have the same name) and some of them not
(putting the same client in twice)

The only solution i can think of for this is to pop up a msg box saying
"There is already a client with this name. Do you wish to continue?" after
the last name has been entered, then if the person says ok, they cary on
filling out the form, and if they cancel, it cancels out that record.

Can someone help me with the code for this?

Also, if anyone knows of a better way of avoiding these unintentional
duplicates, i would love to know.

Thanks,

Kirstie
 
K

Kevin

Kirstie,

Try this.

dim result as variant

result=msgbox("Your Message",vbOkCancel)

if(result= xx)then
do something here
elseif (result=yy)then
do something different
end if

xx and yy differ depending on if it is a YesNo, OkCancel,
etc. Setup your result statement and put a break on the
next line. Check the result value for each response for
the type of message box used.

I hope this helps!
 
J

Jack

If I understand your problem correctly, you get duplicate
records for the same person because he or she reenters the
record, after it is created the first time, by entering a
name instead of an ID number. The solution is to make sure
the customer uses an ID number for accessing a record that
has already been created.
 
D

Dave Elliott

Use this code on the before update event. Then enter your MsgBox Statement
after this code to whatever you want.
Hope this helps, Dave

DLookUp("[Customer ID]","[Customers]","[Customer ID] = Form.[Customer ID] ")
Is Not Null


Jack said:
If I understand your problem correctly, you get duplicate
records for the same person because he or she reenters the
record, after it is created the first time, by entering a
name instead of an ID number. The solution is to make sure
the customer uses an ID number for accessing a record that
has already been created.
-----Original Message-----
All,

I have a client info form, and the customers name is entered into two
fields, [FirstName] and [Surname].
I also have a expression [Title]&" "&[FirstName]&" "& [LastName] and the top
of the form to show their complete name, eg. "Miss Jemima Lane".

However, we have been getting lots of duplicates entered, some of them
intentionally (some clients have the same name) and some of them not
(putting the same client in twice)

The only solution i can think of for this is to pop up a msg box saying
"There is already a client with this name. Do you wish to continue?" after
the last name has been entered, then if the person says ok, they cary on
filling out the form, and if they cancel, it cancels out that record.

Can someone help me with the code for this?

Also, if anyone knows of a better way of avoiding these unintentional
duplicates, i would love to know.

Thanks,

Kirstie


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top