473,803 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with OLEDB query expression

I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,ca lShipment.m_shi pDateTime,
calShipment.m_f oreignKey00,cal PkgAgent.m_resi dential,
calPkgAgent.m_S treetAddress,ca lPkgAgent.m_Cit y,
calPkgAgent.m_S tateProv,calPkg Agent.m_Country ,
calPkgAgent.m_P ostalCode,calPk gAgent.m_RoomFl oor,
calPkgAgent.m_D epartment,calPk gAgent.m_Attent ion,
calPkgAgent.Sm_ businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_p rimaryKey=calPa ckage.m_foreign Key
INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_ primaryKey=calP ackage.m_foreig nKey INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Feb 1 '06 #1
2 4844
I think you'll get your answer by posting your question here:
microsoft.publi c.access.querie s

"Terry Olsen" <to******@hotma il.com> wrote in message
news:uk******** ******@tk2msftn gp13.phx.gbl...
I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,ca lShipment.m_shi pDateTime,
calShipment.m_f oreignKey00,cal PkgAgent.m_resi dential,
calPkgAgent.m_S treetAddress,ca lPkgAgent.m_Cit y,
calPkgAgent.m_S tateProv,calPkg Agent.m_Country ,
calPkgAgent.m_P ostalCode,calPk gAgent.m_RoomFl oor,
calPkgAgent.m_D epartment,calPk gAgent.m_Attent ion,
calPkgAgent.Sm_ businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_p rimaryKey=calPa ckage.m_foreign Key
INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_ primaryKey=calP ackage.m_foreig nKey INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***

Feb 2 '06 #2

You need to put the first join within a set of parenthesis:

SELECT calPackage.*,ca lShipment.m_shi pDateTime,
calShipment.m_f oreignKey00,cal PkgAgent.m_resi dential,
calPkgAgent.m_S treetAddress,ca lPkgAgent.m_Cit y,
calPkgAgent.m_S tateProv,calPkg Agent.m_Country ,
calPkgAgent.m_P ostalCode,calPk gAgent.m_RoomFl oor,
calPkgAgent.m_D epartment,calPk gAgent.m_Attent ion,
calPkgAgent.Sm_ businessName
FROM
(calPackage
INNER JOIN calShipment
ON calShipment.m_p rimaryKey=calPa ckage.m_foreign Key)

INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline .com
------------------------------------------------------------------------

"The sum which two married people owe to one another defies calculation. It
is an infinite debt, which can only be discharged through all eternity." --
Goethe

"Terry Olsen" <to******@hotma il.com> wrote in message
news:uk******** ******@tk2msftn gp13.phx.gbl...
I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,ca lShipment.m_shi pDateTime,
calShipment.m_f oreignKey00,cal PkgAgent.m_resi dential,
calPkgAgent.m_S treetAddress,ca lPkgAgent.m_Cit y,
calPkgAgent.m_S tateProv,calPkg Agent.m_Country ,
calPkgAgent.m_P ostalCode,calPk gAgent.m_RoomFl oor,
calPkgAgent.m_D epartment,calPk gAgent.m_Attent ion,
calPkgAgent.Sm_ businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_p rimaryKey=calPa ckage.m_foreign Key
INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_ primaryKey=calP ackage.m_foreig nKey INNER JOIN calPkgAgent
ON calPkgAgent.m_p rimaryKey=calSh ipment.m_foreig nKey00'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***

Feb 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6787
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
0
2963
by: dim mzeura via .NET 247 | last post by:
(Type your message here) -------------------------------- From: dim mzeura I have the same problem too. Please help! System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression ''\\crwfs1\projects12\AP-Wilbur\Analysis_NonQuantitative\Damages_Report\Backup_Exhibits_Leitzinger's_Damages_Calculations', '328424' )'. -----Here is my code----
3
1554
by: Brett | last post by:
The first query will run but the second will not: Dim constring As String Dim id As String = "10-03" File.Delete(FilePath & CSVFileName) constring = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath & DataBaseFileName) Dim objadapter As New OleDbDataAdapter With objadapter
8
3292
by: luis | last post by:
Hi I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 (reading first http://starship.python.net/crew/bwilk/access.html) I have writed the following code def append_from_Access(self): try: import ... conn = win32com.client.Dispatch(r'ADODB.Connection') DSN = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
9
1581
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1 Column1 Row1 Table2 Column1 Row1 ~ 20 Table1 Column1 Row2 ~ 3
0
3867
by: nostradumbass77 | last post by:
Using Enterprise Library 2.0 (Jan 06) and .NET 2.0 (VB.Net 2005) Dim dbPF As Data.Common.DbProviderFactory Try dbPF = Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb") db = New Microsoft.Practices.EnterpriseLibrary.Data.GenericDatabase( _ "Provider=Microsoft.Jet.OLEDB.4.0;Data
0
1528
by: CaJack | last post by:
Hi, I’m having trouble with my code and I’m starting to get lost. The Program takes the country that’s been typed in to the textbox and when the query button is clicked the program queries an access database for all records that contain the selected country. I think that part works, but I’m having trouble with the output. I want to display only certain fields of the record in a multiline text box, each matching record to a new line, like this…...
2
9008
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application. -------------------------------------------------------------------------------- Data type mismatch in criteria expression.
2
1541
by: johnmay1248 | last post by:
I am having a problem with queries running in this code When I use the query "SELECT * FROM sample" the code runs and the data grid binds and shows the contents of the sample table. If I change the query to filter the results such as "SELECT * FROM sample WHERE (sales 2000)" the code fails on - objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection) with an unknown error. If I load the database up into access2000...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3795
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.