Specify data types in Access parameter queries

Are your Microsoft Access users having a difficult time getting a parameter query to work? The problem may be due to a mismatched data type. Learn how to change the data type for the query parameter.

When Microsoft Access users complain that a parameter query does not work, it may be that the Query Parameter's data type does not match the field's data type.

For example, to obtain a listing of the hours each employee worked for the week ending 05/20/2005, the user might enter 5/20/05. Since, by default, the data type for a query parameter is text, it would not match a Week Ending field whose data type is Date/Time and formatted as mm/dd/yyyy.

If you don't want your users to concern themselves with date formats, change the data type for the query parameter by following these steps:

  1. Open the Parameter Query in design view.
  2. Right-click the table pane.
  3. Select Parameters.
  4. Under Parameter, type Enter Week Ending Date (your parameter prompt without the brackets).
  5. Select Date/Time from the Data Type drop-down box.
  6. Click OK.

Now users can enter the week ending date in any format and still obtain the correct results.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

Editor's Picks

Free Newsletters, In your Inbox