Using Active X Calendar in query

  • Thread starter Thread starter Broadbonian
  • Start date Start date
B

Broadbonian

Trying to use a make table query. Would like to use starting date in the
form, then increment by 1, 2 ect..to get Monday-Sat dates. Get "Data type
mismatch in query expression". Can anyone help? Thanks
SELECT Forms!frmDates!startdate AS Sun, Forms!frmDates!startdate+1 AS Mon
INTO test;
 
Not sure whether it'll work, but try

SELECT CDate(Forms!frmDates!startdate) AS Sun,
CDate(Forms!frmDates!startdate)+1 AS Mon INTO test;

Of course, your table isn't normalized, so you might want to reconsider what
you're doing.
 
Broadbonian said:
Trying to use a make table query. Would like to use starting date in
the form, then increment by 1, 2 ect..to get Monday-Sat dates. Get
"Data type mismatch in query expression". Can anyone help? Thanks
SELECT Forms!frmDates!startdate AS Sun, Forms!frmDates!startdate+1 AS
Mon INTO test;

Two things:
1. Be explicit: Forms!frmDates!startdate.value <--

2. You will likely need a PARAMETERS clause to tell Access to apply the
proper datatype to the value from the form control:
PARAMETERS Forms!frmDates!startdate.value DateTime;
SELECT ...
 
That's exactly what I needed. Thank You
--
Darc


Douglas J. Steele said:
Not sure whether it'll work, but try

SELECT CDate(Forms!frmDates!startdate) AS Sun,
CDate(Forms!frmDates!startdate)+1 AS Mon INTO test;

Of course, your table isn't normalized, so you might want to reconsider what
you're doing.
 
Back
Top