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

Converting QBE Query to SQL string

Good Afternoon

I am trying to convert an Access QBE Query to an SQL string and I am not sure where the error is. This query Joins two tables (Top, Bottom) and makes a New Table "Join_Top_Bottom". The QBE works in acces, here is the Access version of the SQL;

SELECT TOP_050307.obs, TOP_050307.MHSclaim, TOP_050307.line, TOP_050307.CompNo, TOP_050307.Vendor, TOP_050307.PayVendor, TOP_050307.topay, Bottom_050307.ORGClaim, Bottom_050307.PayCode, Bottom_050307.LOB, Bottom_050307.MKTSEG, Bottom_050307.CLientPlanReg, Bottom_050307.RouteCode, Bottom_050307.VTClaim, Bottom_050307.ReportDate INTO Join_Top_Bottom
FROM Bottom_050307 INNER JOIN TOP_050307 ON Bottom_050307.obs = TOP_050307.obs;

I Know that it isnt a direct transpostion from the QBE to SQL but every syntax I've tried wont compile, or I get an error.


Dim strSQL As String

strSQL = SELECT TOP_050307.obs, TOP_050307.MHSclaim, TOP_050307.line, TOP_050307.CompNo, TOP_050307.Vendor, TOP_050307.PayVendor, TOP_050307.topay, Bottom_050307.ORGClaim, Bottom_050307.PayCode, Bottom_050307.LOB, Bottom_050307.MKTSEG, Bottom_050307.CLientPlanReg, Bottom_050307.RouteCode, Bottom_050307.VTClaim, Bottom_050307.ReportDate _
& INTO Join_Top_Bottom _
& FROM Bottom_050307 _
& INNER JOIN TOP_050307 _
& ON Bottom_050307.obs = TOP_050307.obs;

DoCmd.RunSQL strSQL

This bit of code produce the error: Compile Error: Syntax error. If there are any tips someone can pass on I been keen to listen as I need to do this sort of thing quite frequently. I've been picking up a bit of SQl here and there but I havent been able to make the leap from the examples to my specific applications.

Thanks,
Beebelbrox



Any Help would be greatly appreciated
Nov 16 '07 #1
3 2194
debasisdas
8,127 Expert 4TB
What is the use of INTO Join_Top_Bottom in the sql statment ?
Nov 17 '07 #2
QVeen72
1,445 Expert 1GB
Hi,

I'am not sure, but String should be enclosed in double quotes (Missing in your post)..
Proper Line Breaks should be given, so that the string is readable..

Check this :

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT TOP_050307.obs, TOP_050307.MHSclaim, " _
  2. & " TOP_050307.line, TOP_050307.CompNo, TOP_050307.Vendor, "  _
  3. & " TOP_050307.PayVendor, TOP_050307.topay, " _
  4. & " Bottom_050307.ORGClaim, " _
  5. & " Bottom_050307.PayCode, Bottom_050307.LOB, " _
  6. & " Bottom_050307.MKTSEG, Bottom_050307.CLientPlanReg, " _
  7. & " Bottom_050307.RouteCode, Bottom_050307.VTClaim, " _
  8. & " Bottom_050307.ReportDate " _
  9. & " INTO Join_Top_Bottom " _
  10. & " FROM Bottom_050307 " _
  11. & " INNER JOIN TOP_050307 " _
  12. & " ON Bottom_050307.obs = TOP_050307.obs "
  13.  
Regards
Veena
Nov 17 '07 #3
What is the use of INTO Join_Top_Bottom in the sql statment ?

INTO statement would be used to create the third table "Join_Top_Bottom". This code takes two tables and joins them together in a third table.
Nov 19 '07 #4

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

Similar topics

3
by: usenet | last post by:
I have inherited a table where date information was saved from PHP as a VARCHAR. (Sigh.) This means that the so-called date fields look like this : August 1, 2005, 9:09 am EDT October 13, 2004,...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
2
by: Roy Rodsson via .NET 247 | last post by:
Hi all! I am using a stored procedure in SQL2000 for retrieving fileinformations from a db. the table as an uniqueidentifier for the file information. The stored procedure has a variable...
59
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
2
by: LittlePython | last post by:
I am trying to create a hexstring of a NT4 user account sid which I can in turn use to query an exchange 55 database. I believe I need to convert a binary sid to a hex string. ADsSID com object...
4
by: pmcgover | last post by:
I enjoyed Paul Barry's September article in Linux Journal entitled, "Web Reporting with MySQL, CSS and Perl". It provides a simple, elegant way to use HTML to display database content without any...
4
by: ll | last post by:
My data input page uses a id generator which includes dashes, and the corresponding column in the db is set up as varchar to handle that. There is a problem, however, when the value in the varchar...
11
by: Keith Hughitt | last post by:
Hi, I am having a little trouble figuring out how to convert a python datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a UTC date so that when I send it to...
1
by: Michelle Sollicito eBarster | last post by:
Ok I know a lot of asp but not a lot of asp.net and C# so please bear with me. I need some help converting.. In my asp project I have some styles in my head tag that change according to a...
1
by: jrod11 | last post by:
Hi everyone, I am currently working on a project that pulls data from sql and displays it in an html file. This is working fine, but I am trying to make it a little more fancy using this cool source...
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.