IcyPopTarts
IcyPopTarts

Reputation: 504

Format Text Field To Date In Access Query

I have a form in Access that has two text boxes that are format to be a short date. I am now attempting to capture those values and use in a query in the WHERE clause. I tried this syntax

Between CDate([Forms]![Form1]![date1]) And CDate([Forms]![Form1]![date2])

This expression is typed incorrectly, or it is to complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.

How should I capture & convert the entries from my form text boxes so that I can use them in my query?

Upvotes: 0

Views: 198

Answers (1)

Gustav
Gustav

Reputation: 55841

Specify the parameters to free Access from guessing, then use these "as is":

Parameters
    [Forms]![Form1]![date1] DateTime,
    [Forms]![Form1]![date2] DateTime;
Select 
    <your select statement>
From 
    <your table/query>
Where
    [YourDateField] Between 
        [Forms]![Form1]![date1] And 
        [Forms]![Form1]![date2]

Upvotes: 0

Related Questions