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

search on date syntax problem

Status
Not open for further replies.

twtickle

IS-IT--Management
Aug 16, 2001
6
US
Help me with this code. I have a simple database in VB using dao. I want to
allow the user to ender a date in a text box and then press a command button
to have the program delete all the records that have a date in the date
filed of that table older than the date in the text box. No matter how I try
to format it i always get a syntax error. here's the code.
I've tried double " or single'. If I try " I get Expected :List seprator or)
Help!

pdate = Text1.Text
Dim Dog As Database, cat As Recordset
Set Dog = DBEngine.Workspaces(0).OpenDatabase _
("C:\lockck\lockck.mdb")
Dog.Execute (&quot;DELETE from lockck WHERE [date]< #'& pdate&'# &quot;)


 
Try this:

Dog.Execute (&quot;DELETE from lockck WHERE [date] < #&quot; & pdate & &quot;# &quot;)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
IT WORKED!!!!!!!!!!!!!!!!
Thank You!
Thank You! Thank You! Thank You! Thank You! Thank You!
 
You're welcome!
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top