Dcount Problem

Drunkenneo

Registered User.
Local time
Tomorrow, 04:08
Joined
Jun 4, 2013
Messages
192
I have a statement

int1 = DCount("*", "tblDataentry", "((([tblDataentry].[dateofTravel])=#" & d & "#) AND (([tblDataentry].[flightNo])= " & Chr(34) & e & Chr(34) & ") AND (([tblDataentry].[membershipNo])= " & Chr(34) & l & Chr(34) & ") AND (([tblDataentry].[origin])= " & f & ") AND (([tblDataentry].[dest])= " & g & "))")

I have a table where i have to check dupliates is already yhere or not, but even after the same data i couldnot able to get count of int1 other than 0. Please help , Thanks in Advance
 
Show the table structure for "tblDataentry", a Print screen, and also some information how d, e, f, I and g are dimmed.
Only an advice, give your variable a saying name, (and the same for controls - Me.Text1 isn't a good name, in 5 days you don't know what Me.Text1 represent)!
 
Last edited:
Attached is for same

l = txb_memno.Value
d = Format(txb_dot.Value, "dd/mm/yyyy")
e = txb_fltno.Value
f = cmb_Orig.Value
g = cmb_dest.Value
 

Attachments

  • de.jpg
    de.jpg
    61.9 KB · Views: 76
Last edited:
How are d, e, f, I and g dimmed?
 
l = txb_memno.Value
d = Format(txb_dot.Value, "dd/mm/yyyy")
e = txb_fltno.Value
f = cmb_Orig.Value
g = cmb_dest.Value

They are the values associated.
 
Change the date format to US format "mm/dd/yyyy".
Code:
d = Format(txb_dot.Value, "mm/dd/yyyy")
 
why is it so...because i have if uk format and my machine also have uk format for Date
 
In VBA code, delimit dates with the "#" symbol. Regardless or your regional settings, Access expects these literal dates to be in the American format, e.g. #12/31/1999#.
Here is the link to the whole article http://allenbrowne.com/ser-36.html

Did you try it?
 

Users who are viewing this thread

Back
Top Bottom