tumby1974
Posts: 26
|
Posted: 04/18/2011, 10:37 AM |
|
Hi all,
I'm trying to access a record after I hit the "add" button. Well, I'd like to hit the "add" button and be able to access the Address field right afterwards, so I can compare to the Address field in the table.
I'm trying to get info from this record so I can compare it to another field in the table to see if they match (basically to see if the same Address is added to the table again....multiple records of the same address)
Example:
User enters the record (about 10 fields). They press "add",
I want to take the Address field and then compare it to see if it's already in the database. If so, I can then tell a user (via automated email) that there are multiple addresses in the database.
Any help would be appreciated.
|
|
|
amcfadyen
Posts: 8
|
Posted: 05/03/2011, 7:08 AM |
|
Hi
Did you ever find your way around this one? You might already know you need to use the "On Validate" event to examine the content of the posted record and compare it to your database, then add an error to your form if you find a match - although comparing 10 fields, some of which are presumably free text, might be problematic e.g. Street, St, Road, Rd make matching difficult.
Good luck!
|
|
|
tumby1974
Posts: 26
|
Posted: 05/13/2011, 8:23 AM |
|
Quote amcfadyen:
Hi
Did you ever find your way around this one? You might already know you need to use the "On Validate" event to examine the content of the posted record and compare it to your database, then add an error to your form if you find a match - although comparing 10 fields, some of which are presumably free text, might be problematic e.g. Street, St, Road, Rd make matching difficult.
Good luck!
No, I was still working on it. I will try this though. I don't think I'll have to search on all of the fields, I'll just need to compare to see if the address is the same.
I guess in the On Validate, I'll have to do something like a Dlookup? Thanks for your help.
|
|
|
solesz
Posts: 137
|
Posted: 05/17/2011, 10:23 PM |
|
Hi,
What also do the trick: select Yes for the control's "Unique" property on the Data tab. It will automatically do what you want. If duplicate entry is entered the form won't be inserted into database, instead you get an error message on the top of the form: "the filed xxx has to be unique"...
solesz
|
|
|
|