What is an expression builder example to filter all exact matches?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have just created a database. Within the form i have a Last Name field.
Basically what i need, is to be notified (by a msg box in a Macro) everytime
that data entry is made with identical last names. I dont want to prevent it
same last name data entry and there is no 1 last name i want to filter. Just
any general last names that happen to be exacally the same. I know how to do
this if it was only 1 last name, however thats not what i need. I thought
this would be possble but am having lots of trouble in finding out how to do
it... If anyone has any idea please help!!!! :-)
 
there is nothing intrinsic i.e. built-in with Access that does this as you
wish.

If one is comfortable with VB then one can write a module that will pull
your last name column into an array and do a compare.

If you are not comfortable with VB then you might consider first applying a
name to a simple parameter query against the existing DB. It would be a
separate step from your form entry and not an integrated process with your
form entry - - but it is simple and would work.. look up 'parameter query'
for instructions on this...
 
Anna,

Make a macro with the MsgBox action, and enter an appropriate message to
display. In the Condition (if you can't see a Condition column in the
macro design window, select it from the View menu), put the equivalent
of this...
DCount("*","YourTable","[LastName]='" & [LastName] & "'")>0
Assign this macro on the Before Update event of your form, or the After
Update event of the LastName textbox on your form.
 
Thanks Steve. Your a legend! It did exacally what i wanted it to.

Steve Schapel said:
Anna,

Make a macro with the MsgBox action, and enter an appropriate message to
display. In the Condition (if you can't see a Condition column in the
macro design window, select it from the View menu), put the equivalent
of this...
DCount("*","YourTable","[LastName]='" & [LastName] & "'")>0
Assign this macro on the Before Update event of your form, or the After
Update event of the LastName textbox on your form.

--
Steve Schapel, Microsoft Access MVP

I have just created a database. Within the form i have a Last Name field.
Basically what i need, is to be notified (by a msg box in a Macro) everytime
that data entry is made with identical last names. I dont want to prevent it
same last name data entry and there is no 1 last name i want to filter. Just
any general last names that happen to be exacally the same. I know how to do
this if it was only 1 last name, however thats not what i need. I thought
this would be possble but am having lots of trouble in finding out how to do
it... If anyone has any idea please help!!!! :-)
 
Back
Top