Results 1 to 3 of 3

Thread: Sql Statement

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    675

    Sql Statement

    Hi

    Below Sql Statement is giving me error when i added this code

    inner join tblbooks t2 on t1.book_id = t2.book_id

    Dim rs As New ADODB.Recordset

    rs.Open "SELECT * FROM tblmaster t0 inner join tbltrans t1 on t0.issue_no = t1.issue_no inner join tblbooks t2 on t1.book_id = t2.book_id where t0.issue_no = '" & txtissue_no.Text & "'", cnn1, adOpenStatic, adLockReadOnly

    Thanks

  2. #2
    Lively Member
    Join Date
    Feb 2008
    Posts
    100

    Re: Sql Statement

    try this

    rs.Open "SELECT * FROM (tblmaster t0 inner join tbltrans t1 on t0.issue_no = t1.issue_no) inner join tblbooks t2 on t1.book_id = t2.book_id where t0.issue_no = '" & txtissue_no.Text & "'", cnn1, adOpenStatic, adLockReadOnly

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,501

    Re: Sql Statement

    Thread moved to the 'Database Development' forum - which is where you should always post SQL questions (while SQL can be used in VB, it is certainly not specific to VB)


    Don't just tell us "an error" happened, tell us what the error was. Errors have messages for a reason, and they are very good things - they tell us the problem, and from that we can work out the solution (or at least try to).

    As your question concerns SQL, it would also be very useful to tell us which database system you are working with.

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