Solved

syntax error in FROM clause

Posted on 2016-09-25
5
62 Views
Last Modified: 2016-09-26
Hi i am using adodc4 control to print but getting error "Syntax error in FROM clause"
"BillSumry" is not table but its a query in access,

Please assist

    With Adodc4                    
         .RecordSource = "SELECT Invo_No,Date_Invo,Net_Amt,Pkg_Chg,Pkg_Amt,Comison,Tax_Amt,Loading,DiscOn FROM BillSumry"
        .Refresh
        
    End With
    
    With DataReport10
        
        Set .DataSource = Adodc4
        
        .Sections("Section2").Controls("Label3").Caption = Text2.Text
        .Show
    
    End With

Open in new window

0
Comment
Question by:crystal_Tech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 37

Expert Comment

by:PatHartman
ID: 41814760
Open the Access query editor in SQL view.  Paste in the SQL string and run the query.  Do you get any errors?  Does it prompt for a variable?

Does BillSummary take any arguments?
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 41815049
Thanks for reply
No, Not getting any error, And no any prompt for variable..?
getting all data,
and this is the query,  BillSummary is not table but query in DB (Ms Access)
SELECT DISTINCT BillDtl.BillNo AS Invo_No, CFT_NEW.Date_Invo, BillDtl.NetAmt AS Net_Amt, BillDtl.PkgChg AS Pkg_Chg, BillDtl.PkgAmt AS Pkg_Amt, BillDtl.Commission AS Comison, BillDtl.TaxAmt AS Tax_Amt, BillDtl.Loading, BillDtl.DiscOn, BillDtl.DiscAmt, BillDtl.GrandTTL, BillDtl.BndlTTL, CFT_NEW.CustName
FROM BillDtl, CFT_NEW
WHERE BillDtl.BillNo=CFT_NEW.InvoNo;

Open in new window

and this is from VB code..as i mention in my question
"SELECT Invo_No,Date_Invo,Net_Amt,Pkg_Chg,Pkg_Amt,Comison,Tax_Amt,Loading,DiscOn FROM BillSumry"

Open in new window

0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 41815150
What happens if you use Select *?
Also are you sure about the name of the query BillSumry?
0
 
LVL 37

Accepted Solution

by:
PatHartman earned 500 total points
ID: 41815305
FROM BillDtl, CFT_NEW
is old fashioned syntax and in an Access query results in a Cartesian Product which among other issues is always not updateable.

Make the join specific by changing the where clause to a join.

FROM BillDtl Inner Join CFT_NEW ON BillDtl.BillNo = CFT_NEW.InvoNo;
0
 
LVL 1

Author Closing Comment

by:crystal_Tech
ID: 41816145
it works
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question