G
Guest
Ok, so I've seen how you use DCount to check the value of a query, but what
is the syntax of the DCount function if you want the criteria in the DCount
statement?
Here's my situation: I have a form named New Lender Legal Name. On that
form is a field named NewLenderLegalName. I want the user to enter the value
into that field, then I want to have the macro check the LenderLegalNames
table to determine if the name is already present. (I know I can use the no
duplicates function of the table to prevent duplicate names, but I won't go
into why they want to include validation at this point in addition to the
table restrictions)
My criteria is as follows:
DCount("[ID]","LenderLegalNames",[Forms]![New Lender Legal
Name]![NewLenderLegalName]=[LenderLegalNames]![LenderLegalName])>0
I'm trying to count the [ID] returns from the table "LenderLegalNames' where
the LenderLegalName is equal to the NewLenderLegalName on my form.
I could have sworn I've used this function and syntax on an old project but
for the life of me I cannot figure out what I'm doing wrong on the criteria.
I don't want to have to have a query out there just to check duplicates of
the name - I'd like to keep it compact and in the macro code.
Thanks!
is the syntax of the DCount function if you want the criteria in the DCount
statement?
Here's my situation: I have a form named New Lender Legal Name. On that
form is a field named NewLenderLegalName. I want the user to enter the value
into that field, then I want to have the macro check the LenderLegalNames
table to determine if the name is already present. (I know I can use the no
duplicates function of the table to prevent duplicate names, but I won't go
into why they want to include validation at this point in addition to the
table restrictions)
My criteria is as follows:
DCount("[ID]","LenderLegalNames",[Forms]![New Lender Legal
Name]![NewLenderLegalName]=[LenderLegalNames]![LenderLegalName])>0
I'm trying to count the [ID] returns from the table "LenderLegalNames' where
the LenderLegalName is equal to the NewLenderLegalName on my form.
I could have sworn I've used this function and syntax on an old project but
for the life of me I cannot figure out what I'm doing wrong on the criteria.
I don't want to have to have a query out there just to check duplicates of
the name - I'd like to keep it compact and in the macro code.
Thanks!