Solved

syntax error in FROM clause

Posted on 2016-09-25
5
33 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
  • 2
  • 2
5 Comments
 
LVL 34

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 34

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now