Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 8th, 2004, 06:15 PM
xyfix xyfix is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 249 xyfix User rank is Private First Class (20 - 50 Reputation Level)xyfix User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 8 h 26 m 57 sec
Reputation Power: 6
error runsql command

Can anybody help me with my problem.I have a sql statement error. This is the statement causing the problem

TRANSFORM sum([tblTempSelectie].[AANTAL]) AS AANTAL
SELECT [tblTempSelectie].[NED_NAAM]
FROM tblTempSelectie
GROUP BY [tblTempSelectie].[NED_NAAM]
PIVOT [tblTempSelectie].[TEL_NR];

I know many of you think I am posting on the wrong board, but I assure you I am not. The statement it self is ok, meaning it works, but when i use it in vb i get an error. This how I'm using it :

qry = TRANSFORM sum([tblTempSelectie].[AANTAL]) AS AANTAL
SELECT [tblTempSelectie].[NED_NAAM]
FROM tblTempSelectie
GROUP BY [tblTempSelectie].[NED_NAAM]
PIVOT [tblTempSelectie].[TEL_NR];

docmd.runsql qry

and this is the error :

An runsql action requires an argument consisting of an sql statement.

How come??? The statement is a valid sql statement.
__________________

Reply With Quote
  #2  
Old February 8th, 2004, 07:17 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 13th Plane (11000 - 11499 posts)
 
Join Date: Jun 2003
Posts: 11,148 Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level)Doug G User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 54 m 3 sec
Reputation Power: 857
If you posted your exact code, you need to quote the sql text when you build it into the qry variable, and you will need to concatenate each line since you have more than one line of text for the sql.

PHP Code:
 qry "TRANSFORM sum([tblTempSelectie].[AANTAL]) AS AANTAL"
qry qry " SELECT [tblTempSelectie].[NED_NAAM]"
qry qry " FROM tblTempSelectie"
qry qry " GROUP BY [tblTempSelectie].[NED_NAAM]"
qry qry " PIVOT [tblTempSelectie].[TEL_NR];" 

Reply With Quote
  #3  
Old February 8th, 2004, 07:49 PM
xyfix xyfix is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 249 xyfix User rank is Private First Class (20 - 50 Reputation Level)xyfix User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 8 h 26 m 57 sec
Reputation Power: 6
error runsql command

Sorry my fault, you may hit me. The code is already between quotes and it is one line. I 've used the docmd.runsql a couple of times, but using this sql statement gave me the problem. If I'm not wrong the syntax is ok.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > error runsql command


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 5 hosted by Hostway
Stay green...Green IT