DCount Question

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

Guest

I'm just making sure no duplicates exist for one field - but it's not picking
them up. I think it's because of upper/lowercase confusion. The Code in the
table is in upper case and the code in my form is forced to upper by a ">" in
the format property. I'm not really a flash programmer, could someone help me
with some magic to make this work ok?

Cheers

Nick

If DCount("Vendor_Code", "Vendor", "Vendor_Code ='" & Vendor_Code.Value &
"'") > 0
Then
MsgBox Vendor_Code & " Already Exists", vbOKOnly
End If
 
I'm just making sure no duplicates exist for one field - but it's not picking
them up. I think it's because of upper/lowercase confusion. The Code in the
table is in upper case and the code in my form is forced to upper by a ">" in
the format property. I'm not really a flash programmer, could someone help me
with some magic to make this work ok?

Cheers

Nick

If DCount("Vendor_Code", "Vendor", "Vendor_Code ='" & Vendor_Code.Value &
"'") > 0
Then
MsgBox Vendor_Code & " Already Exists", vbOKOnly
End If

Jet is not case sensitive so "abc" and "ABC" will be compared as
equal.
What is the datatype of Vendor_Code?
if it is Text then:
If DCount("*", "[Vendor]", "[Vendor_Code] ='" & [Vendor_Code] &
"'") > 0 Then

If it is a Number datatype, use:
If DCount("*", "[Vendor]", "[Vendor_Code] =" & Vendor_Code) > 0 Then
 
Thanks! That works perfectly

fredg said:
I'm just making sure no duplicates exist for one field - but it's not picking
them up. I think it's because of upper/lowercase confusion. The Code in the
table is in upper case and the code in my form is forced to upper by a ">" in
the format property. I'm not really a flash programmer, could someone help me
with some magic to make this work ok?

Cheers

Nick

If DCount("Vendor_Code", "Vendor", "Vendor_Code ='" & Vendor_Code.Value &
"'") > 0
Then
MsgBox Vendor_Code & " Already Exists", vbOKOnly
End If

Jet is not case sensitive so "abc" and "ABC" will be compared as
equal.
What is the datatype of Vendor_Code?
if it is Text then:
If DCount("*", "[Vendor]", "[Vendor_Code] ='" & [Vendor_Code] &
"'") > 0 Then

If it is a Number datatype, use:
If DCount("*", "[Vendor]", "[Vendor_Code] =" & Vendor_Code) > 0 Then
 
Back
Top