T
Tom K via AccessMonster.com
Hi,
Im trying to verify that there are no duplicate records in my table before
saving a new record with my form to that table. I set up a parameter query to
use the info from my form to check if there was a matching record. The query
worked good. This is the SQL;
SELECT tblAddress.StreetNumber, tblAddress.Direction, tblAddress.StreetName
FROM tblAddress
WHERE (((tblAddress.StreetNumber)=[Forms]![frmNewAddress]![StreetNumber]) AND
((tblAddress.Direction)=[Forms]![frmNewAddress]![Direction]) AND ((tblAddress.
StreetName)=[Forms]![frmNewAddress]![StreetName]));
What I wanted to do is to have a command button on the form that would check
to see if there was a duplicate record. If there was it would display a
message box saying that this address already exist, and then it would not let
you save the record. If there were no matching records then it would save the
record, close the form, and move to the last record on the previous form.
I tried to include this into the comand button that closes the form. I tried
to use a macro to do this. I ran the query, and then I tried to use the
condition "Len ( [QDuplicateAddress]![StreetNumber] & [QDuplicateAddress]!
[Direction] & [QDuplicateAddress]![StreetName] ) <> 0". If the condition was
true then it would not save the record but would display a message, if false
then it would save the record and close the form.
When it got to the condition I got a error message "Can't find Automation
Object "QDuplicateAddress".
I'm completely lost, any help would be great.
Thanks,
Tom
Im trying to verify that there are no duplicate records in my table before
saving a new record with my form to that table. I set up a parameter query to
use the info from my form to check if there was a matching record. The query
worked good. This is the SQL;
SELECT tblAddress.StreetNumber, tblAddress.Direction, tblAddress.StreetName
FROM tblAddress
WHERE (((tblAddress.StreetNumber)=[Forms]![frmNewAddress]![StreetNumber]) AND
((tblAddress.Direction)=[Forms]![frmNewAddress]![Direction]) AND ((tblAddress.
StreetName)=[Forms]![frmNewAddress]![StreetName]));
What I wanted to do is to have a command button on the form that would check
to see if there was a duplicate record. If there was it would display a
message box saying that this address already exist, and then it would not let
you save the record. If there were no matching records then it would save the
record, close the form, and move to the last record on the previous form.
I tried to include this into the comand button that closes the form. I tried
to use a macro to do this. I ran the query, and then I tried to use the
condition "Len ( [QDuplicateAddress]![StreetNumber] & [QDuplicateAddress]!
[Direction] & [QDuplicateAddress]![StreetName] ) <> 0". If the condition was
true then it would not save the record but would display a message, if false
then it would save the record and close the form.
When it got to the condition I got a error message "Can't find Automation
Object "QDuplicateAddress".
I'm completely lost, any help would be great.
Thanks,
Tom