473,378 Members | 1,099 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,378 software developers and data experts.

error in between operator

198 100+
hello expert
i want to insert the records from one database to another on a particular condition i,e between two dates
if i insert all the records it works fine but i need the records on particular date
but when i insert the records by using between operator then it shows the
"syntax error in query string Date between 12\10\2007 And 14\10\2007"
my query is
squery = "Insert into " & Text4 & " IN '" & Text2 & "' select * from " & Text3 & " IN '" & Text1 & "' where Date Between " & Text5 & " AND " & Text6 & ""

please send some idea
thanks
Nov 17 '07 #1
3 1478
QVeen72
1,445 Expert 1GB
Hi,

Enclose Dates with #

Expand|Select|Wrap|Line Numbers
  1. squery = "Insert into " & Text4 & " IN '" & Text2 & "' select * from " & Text3 & " IN '" & Text1 & "' where Date Between #" & Format(Text5,"dd-mm-yyyy") & "# AND #" & Format(Text6,"dd-mm-yyyy") & "#" 
  2.  
PS: dont use Keywords like "Date" as field names..

Regards
Veena
Nov 17 '07 #2
veer
198 100+
hello expert
Its working but when i put two date in text5 and text6 then it search the data from text6 value onwords, i changed the field name date to Ypdate
e.g
text5 = 12\10\2007 and text6 = 14\10\2007
it starts searching from 14\10\2007 and all the values after this date
thanks in advance


Hi,

Enclose Dates with #

Expand|Select|Wrap|Line Numbers
  1. squery = "Insert into " & Text4 & " IN '" & Text2 & "' select * from " & Text3 & " IN '" & Text1 & "' where Date Between #" & Format(Text5,"dd-mm-yyyy") & "# AND #" & Format(Text6,"dd-mm-yyyy") & "#" 
  2.  
PS: dont use Keywords like "Date" as field names..

Regards
Veena
Nov 17 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

Why do you have 2 "IN" in your SQL Statement..

change it :

Expand|Select|Wrap|Line Numbers
  1. squery = "Insert into [" & Trim(Text4) & "].[" & Trim(Text2) & "] select * from [" & Trim(Text3) & "].[" & Trim(Text1) & "] Where Date Between #" & Format(Text5,"dd-mm-yyyy") & "# AND #" & Format(Text6,"dd-mm-yyyy") & "#"
  2.  
  3.  
Correct me if I'am wrong:
Text4: Destination Path
Text2 : Destination Table Name
Text3: Source Path
Text2 : Source Table Name


Regards
Veena
Nov 17 '07 #4

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

Similar topics

1
by: Maciej Paras | last post by:
Hello! I've written 2 pages: one i HTML format, and second - in ASP. When I'm posting data from HTML page, I receive this error generated by ASP page: Microsoft JET Database Engine (0x80040E14)...
2
by: Laxman | last post by:
==C.H <== #include <fstream.h> class C { public: C(int i); friend ofstream& operator<<(ofstream& os, const C&); }; ------------------------------------------------------------ ==B.H <==
2
by: Gernot Frisch | last post by:
This code: class A { #define MK_OPERATOR_CL(zz) \ DGStr& operator zz=(const DGStr& a); \ DGStr& operator zz=(int a); \ DGStr& operator zz=(float a); \ DGStr& operator zz=(double a); ...
2
by: Dai Kane | last post by:
Am experimenting with some range-bound numeric class thingy, and now wondering this situation: int a = 10; myclass b(6); if ( a > b ) { ... }
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: Greg Buchholz | last post by:
I'm wondering if anyone has advice for figuring out error messages produced by g++. The programs below works fine, until I uncomment out the two "transform" lines. Then it points me to line 24...
6
by: Angus | last post by:
I am using a global which is a void* I have it defined in one file as: void* hFlag; and one other header file as: extern void* hFlag; But I get this compile error:
10
by: subramanian100in | last post by:
consider the following program: #include <iostream> using namespace std; class my_complex { public: friend ostream & operator<<(ostream &os, const my_complex &c);
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.