WildCard not accepted

BrainDead

Registered User.
Local time
Today, 16:39
Joined
Aug 24, 2001
Messages
12
I have a query that that uses a datefield from a txtbox to bring back records.

If I give the query the exact criteria like 14-Aug-01 I get the results. But since I want to get all the records in Aug-01, I have the following criteria:

Like "*" & [Forms]![renewalform]![date] & "*"

Where [date]'s value is Aug-01,
So why doesn't the Wildcard work?

Thnx
 
all the records in Aug-01

Between 8/1/2001 and 8/31/2001 (if there is a 31)
 
That will require the user to alter the query to specify the dates of between. If you are using the form to make it easier to choose what month or date you want, try this.

Create an unbound form with two unbound controls. One named FROMDATE and the other TODATE. Put a button on the unbound form to run your query on click.

Set the criteria on your query to:

Field: YourTable'sRecordDate
Criteria: write is like below...

>=[Forms!UnboundFormName![FROMDATE] and <=[Forms!UnboundFormName![TODATE]

That is simply called a "parameter query"! There are some "tweaking" things you can do to your unbound form to make it work even better...like when someone doesn't enter the end date. Like setting the criteria of the query to what I put above and also setting the OR part of the criteria to >=[FROMDATE] and <=now() which will return a history of records from 8-1-2001 if you want or 5-14-2001 to 8-24-01 if you please. Play around, you'll find that this type of query specification can be very useful for user input!
Hope you like it!
 

Users who are viewing this thread

Back
Top Bottom