Use an expression field in a criteria for a query

saschmeling

New Member
Joined
Jun 27, 2012
Messages
39
Hi,

I am building a Query that requires the following:

ID
Separation Date (this is a criteria field- to minimize the results)
Department (Criteria field to find an individual department)
Reason

This query will feed into a report. I am also using a form to feed the Department Criteria because the department names are very long. I would like the Separation Date to pull from the same form but give me a range such as:

Criteria:
Between [enter a start date] and [enter an ending date]

I would like the start date and ending date to pull the information off of the form.

For the Department- I used a simple statement: [forms]![formName]![fieldName] to get the criteria. This is not working for the between statement.

Does anyone have any suggestions?

Thanks in advance.
Scott
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Have you formatted the textbox on the form to date? I'm not sure if that is necessary but it can't hurt.

Between [Forms]![formname]![objectname1] And [Forms]![formname]![objectname2] should work. When you say it isn't working is it giving you an error or just not giving the results you expect?
 
Upvote 0
Have you formatted the textbox on the form to date? I'm not sure if that is necessary but it can't hurt.

Between [Forms]![formname]![objectname1] And [Forms]![formname]![objectname2] should work. When you say it isn't working is it giving you an error or just not giving the results you expect?


Must have been typos on my part- not sure what I did but when I used the expression builder with >= and <= it worked perfectly fine.

Thanks for the info.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top