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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

db search with dates

Status
Not open for further replies.

crashc123

Technical User
Oct 3, 2001
80
US
I want to do a search of all fields of db, how would you do that with dates?

Say if someone typed in a "12" I want it to search all the text fields and date fields then show all records that have it in the fields. "12" could day or month or even part of the year

Something like

strSQL = "SELECT textfield, datefield FROM mytable "_
& "WHERE textfield LIKE '%" & Replace(strSearch, "'", "''") & "%" _
'here's the problem I have no idea how to do this
& "OR "Cstr("datefield")" LIKE '%" & Replace(strSearch, "'", "''") & "%"


?????
Microsoft VBScript compilation (0x800A0400)
Expected statement

I would appreciate any help



 
I guess I would cast/convert (depending on the dbms' syntax) the datefield into a char and then use LIKE %%
...
Are you using SQL-server, Access, something else? This is not a bug - it's an undocumented feature...
;-)
 
I am using an Access DB. How would I connvert it? Before the sql state or in the middle.
Please give an example.

Thanks

Sonya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top