SunQuest
 
           Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 24th, 2002, 02:12 PM
mab mab is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 39 mab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Access 2000

Hi,

Can anyone help me make sense of SQL strings. I have an ADO connection to a database and am attempting to insert data into a table. I have the insert....
& "Values ('" & olptbl & "'," & 1 & ", " & 0 & ", " & olpdate & ", " & mydate _
& ", " & mytime & ", " & uid & ", " & "'CARD'" & ", " & olid & ", " & olcrdtype _
& ", '" & olcardno & "', '" & olexp & "', '" & "" & olpaid _
& ", " & 0 & ", " & 0 & ", " & tnum & ", " & -1 & ", " & -1 & "," & mitem _
& ", " & 0 & ", " & -1 & ", " & 0 & ", " & N & ", " & 0 & ", " & olpaid _
& ", " & 0 & " ," & -1 & ", " & 0 & ")"

How do I know when I need double quotes verses single quote? I'm getting a syntax error and am not sure what I am looking at.
Appreciate any help.

Reply With Quote
  #2  
Old April 27th, 2002, 05:59 PM
joewmaki joewmaki is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 1 joewmaki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re: Access 2000

String, text values need to be in single quotes, numeric values do not. For SQL, dates are generally delimited by single quotes. Traditionally Acess has used # to delimit date values. Unfortunately I've never used ADO against an Acess2000 mdb, so I can't say for sure which will work. I'd guess the # would still be the preferred, unless Access has migrated to a standard SQL syntax for compatability with SQL Server.

...joe

Quote:
Originally posted by mab
Hi,

Can anyone help me make sense of SQL strings. I have an ADO connection to a database and am attempting to insert data into a table. I have the insert....
& "Values ('" & olptbl & "'," & 1 & ", " & 0 & ", " & olpdate & ", " & mydate _
& ", " & mytime & ", " & uid & ", " & "'CARD'" & ", " & olid & ", " & olcrdtype _
& ", '" & olcardno & "', '" & olexp & "', '" & "" & olpaid _
& ", " & 0 & ", " & 0 & ", " & tnum & ", " & -1 & ", " & -1 & "," & mitem _
& ", " & 0 & ", " & -1 & ", " & 0 & ", " & N & ", " & 0 & ", " & olpaid _
& ", " & 0 & " ," & -1 & ", " & 0 & ")"

How do I know when I need double quotes verses single quote? I'm getting a syntax error and am not sure what I am looking at.
Appreciate any help.

Reply With Quote
  #3  
Old May 11th, 2002, 03:20 PM
transient transient is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 6 transient User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to transient
Yes, # will work fine for date fields.

Reply With Quote
  #4  
Old May 19th, 2002, 08:18 AM
» Matt M « » Matt M « is offline
red house painter
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: South east England
Posts: 46 » Matt M « User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to » Matt M « Send a message via AIM to » Matt M «
you can post strings with single quotes around them at all times, access is happy.

if you want null, then obviously you need to get shot of them.

e.g.

"insert into blah values(blah, blah, blah) ('" & strBlah & "'.'" & strBleh & "', '" & strBleach & "')"

if you need a null, test the variables with an if statement and remove the ' ' from the insert. then if it is null, post null and if its got something in it, post "'" & strBleh & "'"

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Access 2000


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway