473,386 Members | 1,791 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.

SQL-Report Query Contains an Error, but where??

48
Hi folks,

I need once again your help. I have a long SQL-Report Query, which has an error build in, however, I do not see it at all. I have typed it with the SQL-Builder, not with the Wizard (don't like that Click and Go).

Does anybody see the mistake, error message: Syntax Error in FROM clause (great Error message) :-)

Expand|Select|Wrap|Line Numbers
  1. SELECT Contacts.FirstName, Contacts.LastName, CostCenter.CostCenter, CostCenter.OrgUnit, CostCenter.Region, 
  2. Workstream.Workstream, Workstream.[Cap/Non-Cap], Work.StartDate, Work.EndDate, Work.[Int/Ext], Vendor.Vendor, 
  3. Contacts.ContactID FROM CostCenter INNER JOIN (Contacts INNER JOIN (Workstream INNER JOIN [Work] (Vendor INNER JOIN [Work] 
  4. ON Vendor.VendorID=Work.Vendor) ON Workstream.WorkstreamID=Work.WorkstreamID)  ON Contacts.ContactID=Work.ContactID) 
  5. ON CostCenter.CostCenterID=Work.CostCenter WHERE (((Work.StartDate)>=[forms]![ReportDateForm]![txtDateFrom]) 
  6. AND ((Work.EndDate)<=[forms]![ReportDateForm]![txtDateTo]));
  7.  
Thanks a lot for the help.

Alive
Aug 15 '07 #1
5 1732
FishVal
2,653 Expert 2GB
Hi folks,

I need once again your help. I have a long SQL-Report Query, which has an error build in, however, I do not see it at all. I have typed it with the SQL-Builder, not with the Wizard (don't like that Click and Go).

Does anybody see the mistake, error message: Syntax Error in FROM clause (great Error message) :-)

Expand|Select|Wrap|Line Numbers
  1. SELECT Contacts.FirstName, Contacts.LastName, CostCenter.CostCenter, CostCenter.OrgUnit, CostCenter.Region, 
  2. Workstream.Workstream, Workstream.[Cap/Non-Cap], Work.StartDate, Work.EndDate, Work.[Int/Ext], Vendor.Vendor, 
  3. Contacts.ContactID FROM CostCenter INNER JOIN (Contacts INNER JOIN (Workstream INNER JOIN [Work] (Vendor INNER JOIN [Work] 
  4. ON Vendor.VendorID=Work.Vendor) ON Workstream.WorkstreamID=Work.WorkstreamID)  ON Contacts.ContactID=Work.ContactID) 
  5. ON CostCenter.CostCenterID=Work.CostCenter WHERE (((Work.StartDate)>=[forms]![ReportDateForm]![txtDateFrom]) 
  6. AND ((Work.EndDate)<=[forms]![ReportDateForm]![txtDateTo]));
  7.  
Thanks a lot for the help.

Alive
Hi, Alive.

I'm not sure. Just a guess. I think this join will not work

(Workstream INNER JOIN [Work] (Vendor INNER JOIN [Work]
ON Vendor.VendorID=Work.Vendor) ON Workstream.WorkstreamID=Work.WorkstreamID)

Anyway, when you build complicated table join do it stepwise running the query each time new table is added to the join to see whether it works and returns records you are expecting for.
Aug 15 '07 #2
alive84
48
Hi, Alive.

I'm not sure. Just a guess. I think this join will not work

(Workstream INNER JOIN [Work] (Vendor INNER JOIN [Work]
ON Vendor.VendorID=Work.Vendor) ON Workstream.WorkstreamID=Work.WorkstreamID)

Anyway, when you build complicated table join do it stepwise running the query each time new table is added to the join to see whether it works and returns records you are expecting for.
Hi Fish,

Thanks, good hint, I will try to solve it step-by-step.

May I ask you another question:? I have a tbl_Contact and tbl_Work which are 1--N related. Now what I would like to implement is a button that adds to the Contact a 2nd Work-Information. Is that possible with SQL? Do you know the command? So that I could do some research.

Thanks a lot
Aug 15 '07 #3
FishVal
2,653 Expert 2GB
Hi Fish,

Thanks, good hint, I will try to solve it step-by-step.

May I ask you another question:? I have a tbl_Contact and tbl_Work which are 1--N related. Now what I would like to implement is a button that adds to the Contact a 2nd Work-Information. Is that possible with SQL? Do you know the command? So that I could do some research.

Thanks a lot
You are welcome.

There are at least two approaches:
  • Normaly this is implemented with Subform
  • If you have some very special reason not to use subform you can simulate subform automation by setting DefaultValues of the controls linked to 1-side table to there current values. Actually this is the same that subform does.
In any case I would suggest you to use subform as more simple, natural and reliable solution.


BTW it looks like continuation of you previous thread,
VB and Form!Field populating (automatically)
have you got it working ?
Aug 15 '07 #4
alive84
48
You are welcome.

There are at least two approaches:
  • Normaly this is implemented with Subform
  • If you have some very special reason not to use subform you can simulate subform automation by setting DefaultValues of the controls linked to 1-side table to there current values. Actually this is the same that subform does.
In any case I would suggest you to use subform as more simple, natural and reliable solution.


BTW it looks like continuation of you previous thread,
VB and Form!Field populating (automatically)
have you got it working ?
No, its already a new issue. Thanks to your help I could solve the first one. :-) I have closed it now.

Back to the ContactID has two WorkID Problem: Do you think I should open a new discussion?
I understand why I should implement a subform, the problem I have is how to create that "create 2ndWork ID button" (the code behind it). Somehow I have to tell this button to leave the information typed in Contacts and simply add a 2nd WorkID.

Thanks
Aug 15 '07 #5
FishVal
2,653 Expert 2GB
No, its already a new issue. Thanks to your help I could solve the first one. :-) I have closed it now.

Back to the ContactID has two WorkID Problem: Do you think I should open a new discussion?
I understand why I should implement a subform, the problem I have is how to create that "create 2ndWork ID button" (the code behind it). Somehow I have to tell this button to leave the information typed in Contacts and simply add a 2nd WorkID.

Thanks
Ok. Let's move to another thread. Plz provide comprehensive information on table structure and relationships.
Aug 15 '07 #6

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

Similar topics

5
by: george lewycky | last post by:
I am trying to take a field description for a column of about 200+ bytes and wrap the field into 3 lines of 70 bytes apiece in PL/SQL!!!!!! I know this can be done in SQL*Plus as show below but...
2
by: Peter | last post by:
I run most of my SQL scripts via kornshell on AIX. I use the "here-document" to run some of the smaller ones. Example: #!/bin/ksh # Analyze the table. sqlplus...
10
by: Dagwood | last post by:
Good morning: At least it's morning where I am. :) I have a rather newbie question I'm afraid. I have VisualStudio.NET, and have installed it along with SQL server. However I can't seem to...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
11
by: Neil | last post by:
We are running SQL 7, using Access 2000 as a front end. Our network person is wanting to migrate to Windows 2003 (we're currently on Windows 2000), and wants to know if we should migrate to SQL...
3
by: datapro01 | last post by:
I am a DB2 DBA that has been asked to become familiar enough with SQL Server in order to become actively involved in its installation, implementation, and to review database backup/recovery...
8
by: M K | last post by:
I am a newbie at C# (VS 2005) and SQL Server(2003). I was able to create a db using my old pc and then copied it to my laptop to my project folder, I cannot connect to it nor can i create a db on...
1
by: Ted | last post by:
I managed to get it installed OK, along side MS Visual Studio 2005 (with which I received it). During the install, I made sure I installed everything. I have developed a number of applications...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
12
by: Darrel | last post by:
I'm still having a hell of a time figuring out this whole SQL Express set up. I finally discovered why I couldn't run the aspnet_regsql...my local sql server wasn't running. I turned that on,...
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: 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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...

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.