Results 1 to 2 of 2

Thread: SQL Statement

  1. #1

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621

    SQL Statement

    Hi All

    I have an SQL String which works in SQL Server but not in access

    The SQL is as follows:

    SELECT TTrnHdrOpenedBy, TTrnHdrTimeStamp, PayNo, PayDescription, TrnPayAmount, TrnMemMember, TTrnDetType
    FROM (tblTillTransactionHeader INNER JOIN tblTransactionPayments
    ON tblTillTransactionHeader.TTrnHdrTranNo = tblTransactionPayments.TrnPayBillNo)
    INNER JOIN tblPaymentMethods ON tblPaymentMethods.PayNo = tblTransactionPayments.TrnPayPayMethod
    INNER JOIN tblTransactionMembers ON tblTillTransactionHeader.TTrnHdrTranNo = tblTransactionMembers.TrnMemHdrNo
    INNER JOIN tblTillTransactionDetail ON tblTillTransactionHeader.TTrnHdrTranNo = tblTillTransactionDetail.TTrnDetHeaderNo
    WHERE TTrnHdrTranNo ='CRX1'


    Can anybody help me suss this out.
    The error it returns in Access is Syntax Error (Missing Operator) in query expression

    tblPaymentMethods.PayNo = tblTransactionPayments.TrnPayPayMethod
    INNER JOIN tblTransactionMembers
    ON tblTillTransactionHeader.TTrnHdrTranNo = tblTransactionMembers.TrnMemHdrNo
    INNER JOIN tblTillTransactionDetail
    ON tblTillTransactionHeader.TTrnHdrTranNo = tblTillTransactionDetail.TTrnDetHeaderNo
    WHERE TTrnHdrTranNo ='CRX1'

    Thanks
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  2. #2
    Member
    Join Date
    Feb 2001
    Location
    St. Louis, Missouri
    Posts
    49
    Are all these tables in Access? If so, I would recommend using the Access query builder to do most of the SQL for you. Just go into design view, show all the tables you want to select from and then choose the fields you want. Then switch to the SQL view and add the "where field = 'CRX1'" at the end of the statement. This way the statment will be built exactly how Access likes it.

    Eva

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width