PC Review


Reply
Thread Tools Rate Thread

fromat SQL string to use in procedure

 
 
tim johnson
Guest
Posts: n/a
 
      1st Feb 2004
I am unable to get the correct format for this SQL
statement so I can use it as a string in a procedure.


This is what I have but it does not work

Thanks for any help

strSQL = "SELECT ApptDate FROM tblAppointment " & _
"WHERE AppDate = & "#" & ApptDate & "#"


Note: ApptDate datattype = Date/Time
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      1st Feb 2004
Your string contains an extra amperssand and quote mark. Try:

strSQL = "SELECT ApptDate FROM tblAppointment " & _
"WHERE AppDate = #" & Format(ApptDate, "mm\/dd\/yyyy") & "#"

The explicit formatting makes sure the date is in the American format
expected in SQL strings.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"tim johnson" <(E-Mail Removed)> wrote in message
news:808701c3e8c2$c14e27d0$(E-Mail Removed)...
> I am unable to get the correct format for this SQL
> statement so I can use it as a string in a procedure.
>
>
> This is what I have but it does not work
>
> Thanks for any help
>
> strSQL = "SELECT ApptDate FROM tblAppointment " & _
> "WHERE AppDate = & "#" & ApptDate & "#"
>
>
> Note: ApptDate datattype = Date/Time



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a procedure when the procedure name is a string Sam D Microsoft Access VBA Modules 2 1st Apr 2005 09:51 AM
Re: How to use string.Fromat() to format these? Cor Ligthert Microsoft Dot NET 0 27th Aug 2004 02:34 PM
Re: How to use string.Fromat() to format these? Cor Ligthert Microsoft Dot NET 3 27th Aug 2004 02:05 PM
Re: How to use string.Fromat() to format these? Niki Estner Microsoft Dot NET 0 27th Aug 2004 01:16 AM
Re: How to use string.Fromat() to format these? Jonathan Allen Microsoft Dot NET 0 26th Aug 2004 06:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 PM.