Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date selection using "Like" 1

Status
Not open for further replies.

pmaxon

Programmer
Sep 25, 2003
68
US
I am using VB6 with an mdb database and using the ocx with CR8.5. I have a date field setup as 03/01/1999. Can I setup a selection criteria along the line of "where date_field like '03'" and select all date fields that start with 03? I keep getting an error through crystal stating "string required", which I assume means that it does not understand my selection formula.
 
Can't use the LIKE operator with a date field (only with strings). You could setup a parameter on the report to get the the Month from VB, then use that in your selection formula:

month({Table.DateField}) = {?MonthParam}

Or, if you'd rather pass the entire date from VB, you could use:

month({Table.DateField}) = month({?DateParam})

-dave
 
Thanks Dave!
month({Table.DateField}) = {?MonthParam}will work perfectly. It's sure easy when you know what the heck you are doing! ;o)

Thanks again,
Pat

PS - You're saving my butt ya know!
 
Careful when using just a month because you'll likely also want to identify data by year.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top