D
Douglas
I want to do a record count on one table
The table is called : Vehicle_Customer and looks like this:
Vehicle_Customer
Reg_No
Make_Model
MOT_Due_Date
etc etc etc
The MOT_Due_Date is a text field in the format "dd mmm" ie "15 Sep",
and for various reasons i have kept it as a text field and not a date
field
Im trying to write a DCount that returns all the MOT_Due_Dates between
the first of the current month and 6 weeks from the first of the
current month.
ie MOT Due Date BETWEEN "01/01/2004" AND "12/02/2004"
So far I have:
tmpcount = DCount("Vehicle_Customer.Reg_No", "Vehicle_Customer", "#" &
Format(Vehicle_Customer.MOT_Due_Date & " " & Format(Now(), "yyyy"),
"mm/dd/yyyy") & "# BETWEEN #" & Format(DateSerial(Year(Now()),
Month(Now()), 1), "mm/dd/yyyy") & "# AND #" & Format(DateAdd("w",
DateSerial(Year(Now()), Month(Now()), 1), 42), "mm/dd/yyyy") & "#")
What i do is add the Current year onto the MOT_Due_Date then convert
it to the format "mm/dd/yyyy".
Im pretty sure the stuff ater the BETWEEN is ok as i use it in another
query.
The error I get is: 424 Object Required
TIA
Doug
The whole purpose of the DCount is because if it returns zero then I
want to flag up a msg that there are no records and then it wont run
the report
The table is called : Vehicle_Customer and looks like this:
Vehicle_Customer
Reg_No
Make_Model
MOT_Due_Date
etc etc etc
The MOT_Due_Date is a text field in the format "dd mmm" ie "15 Sep",
and for various reasons i have kept it as a text field and not a date
field
Im trying to write a DCount that returns all the MOT_Due_Dates between
the first of the current month and 6 weeks from the first of the
current month.
ie MOT Due Date BETWEEN "01/01/2004" AND "12/02/2004"
So far I have:
tmpcount = DCount("Vehicle_Customer.Reg_No", "Vehicle_Customer", "#" &
Format(Vehicle_Customer.MOT_Due_Date & " " & Format(Now(), "yyyy"),
"mm/dd/yyyy") & "# BETWEEN #" & Format(DateSerial(Year(Now()),
Month(Now()), 1), "mm/dd/yyyy") & "# AND #" & Format(DateAdd("w",
DateSerial(Year(Now()), Month(Now()), 1), 42), "mm/dd/yyyy") & "#")
What i do is add the Current year onto the MOT_Due_Date then convert
it to the format "mm/dd/yyyy".
Im pretty sure the stuff ater the BETWEEN is ok as i use it in another
query.
The error I get is: 424 Object Required
TIA
Doug
The whole purpose of the DCount is because if it returns zero then I
want to flag up a msg that there are no records and then it wont run
the report