473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Another Syntax Question

7
I Get "Syntax error in query. Incomplete query clause." (3450) while running this code:
Expand|Select|Wrap|Line Numbers
  1.        strSQL = "SELECT Calendar.MyDate, Calendar.MyTime, Calendar.Currency, Calendar.[Data Released]," & _
  2.             " Calendar.Forecast, Calendar.Previous, Calendar.Impact, [" & tblname & "].F2," & _
  3.             " [" & tblname & "].F3, [" & tblname & "].F4, [" & tblname & "].F5," & _
  4.             " [" & tblname & "].F6, [" & tblname & "].F7" & _
  5.             " INTO " & varData(i) & " " & _
  6.             " FROM Calendar INNER JOIN [" & tblname & "] ON Calendar.MyDate = [" & tblname & "].F1" & _
  7.             " WHERE (((Calendar.Currency)='" & varData(i) & "') AND (([" & tblname & "].F2)" & _
  8.             " Between [Calendar].[MyTime] And [Calendar].[Limit]));"
  9.         DoCmd.RunSQL strSQL
Can anyone spot the problem?
Thanks a bunch in advanced!
Tomba.
Dec 30 '06 #1
3 1555
Tomba
7
Ok, I got the syntax right, but now I have another problem - sorry for bothering:\
For some reason, after running the code below, the records on the table I've created gets deleted (access prmopts me a dialogue box notifying that the existing table I created is going to be deleted before the query is executed, and asking me whether I want to continue or not).
I'll really appreciate any further help!
Expand|Select|Wrap|Line Numbers
  1. Do
  2.     If varData(i) <> "EUR" Then
  3.         strSQL = "SELECT Calendar.MyDate, Calendar.MyTime, Calendar.Currency, Calendar.[Data Released]," & _
  4.             " Calendar.Forecast, Calendar.Previous, Calendar.Impact, [" & tblname & "].F2," & _
  5.             " [" & tblname & "].F3, [" & tblname & "].F4, [" & tblname & "].F5," & _
  6.             " [" & tblname & "].F6, [" & tblname & "].F7" & _
  7.             " INTO [" & varData(i) & "-" & tblname & "]" & _
  8.             " FROM Calendar INNER JOIN [" & tblname & "] ON Calendar.MyDate = [" & tblname & "].F1" & _
  9.             " WHERE (((Calendar.Currency)='" & varData(i) & "')" & _
  10.             " AND (([" & tblname & "].F2) Between [Calendar].MyTime And [Calendar].Limit));"
  11.     Else
  12.         strSQL = "SELECT Calendar.MyDate, Calendar.MyTime, Calendar.Currency, Calendar.[Data Released]," & _
  13.             " Calendar.Forecast, Calendar.Previous, Calendar.Impact, [" & tblname & "].F2," & _
  14.             " [" & tblname & "].F3, [" & tblname & "].F4, [" & tblname & "].F5," & _
  15.             " [" & tblname & "].F6, [" & tblname & "].F7" & _
  16.             " INTO [" & varData(i) & "-" & tblname & "]" & _
  17.             " FROM Calendar INNER JOIN [" & tblname & "] ON Calendar.MyDate = [" & tblname & "].F1" & _
  18.             " WHERE (((Calendar.Currency)='EUR' OR (Calendar.Currency)='E-12' OR (Calendar.Currency)='GER')" & _
  19.             " AND (([" & tblname & "].F2) Between [Calendar].MyTime And [Calendar].Limit));"
  20.     End If
  21.     i = i + 1
  22.     DoCmd.RunSQL strSQL
  23. Loop Until i = 2
Thanx alot!
Tomba.
Dec 30 '06 #2
NeoPa
32,556 Expert Mod 16PB
SELECT INTO (What you're using) is a Make Table query.
That's what they do if they find the destination table already exists.
You probably want an INSERT INTO (Append) query instead.
Remember to clear the existing records first when you run it - assuming that's what you need it to do.
Dec 31 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
SELECT INTO (What you're using) is a Make Table query.
That's what they do if they find the destination table already exists.
You probably want an INSERT INTO (Append) query instead.
Remember to clear the existing records first when you run it - assuming that's what you need it to do.
Append query syntx ...

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO Tablename1 (Field1, Field2)
  2. SELECT Field1, Field2
  3. FROM TableName2;
Mary
Jan 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: ajsiegel | last post by:
Arthur wrote: >> And either intuitively, or consciously, he is doing something that >> offsets it from something truly intergrated into the core of the >> language. By breakling all of his own...
7
by: jesse | last post by:
In java, one constructor can call another constructor through this(...) for instance class foo { public: foo(int k) { this(k,false)}; foo(int k, boolean m){...}; }
5
by: Xiangliang Meng | last post by:
Hi, all. What are the benefit and the drawback of defining a class embedded inside another class? For example: class List { public:
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
188
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
13
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python...
12
by: Yusuf | last post by:
I'm sorry for the second post in as many hours, and both about structs. The code below compiles. The variables test1 and test2 are structures of datatype teststruct1 and teststruct2. The size of...
14
by: rohitkumar | last post by:
this is my code to calculate the sum of digits in a number for eg. 432567 sum =4+3+2+5+6+7=27 i 'm using turboc++ compiler from borland and i 'm runing my program on DOS. ...
17
by: sagar | last post by:
Hi, I have a C file(add.c) in which i have a function called add.now i want to call the same add function from another file sub.c .Can any1 tell how to do that... Thanks in advance Mark
31
by: pradeep | last post by:
Hello friends: I have the following code, char* MyClass::MyMethod() { char* ptr = new char; // space for NULL terminator ptr = "hello"; return ptr; delete ptr;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.