Results 1 to 2 of 2

Thread: How to print SQL???

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Can one tell me how i could print what an sql statement
    is returning in a picture box. If i use frmDriverQuery.picDriverQuery.Print SQL I just get the
    actual query printed into the picture box not what i want
    extracted from the database. I really have no clue how to
    do this! {{{laughing}}}


    Private Sub cmdDriverQuery_Click()
    'When a Drivers ID Number is entered into the textbox and the Driver Query button
    'is clicked a list of accounts that the driver is assigned to will popup
    Dim strSQL As String

    strSQL = "SELECT * FROM [Driver Information]WHERE [Driver ID] = '" & Trim(txtDriverQuery.Text) & "'"

    Set rs = db.OpenRecordset(strSQL)

    frmDriverQuery.Show
    frmDriverQuery.picDriverQuery.Print rs!SQL ?????
    End Sub



  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    You'll need to loop thru the recordset.

    Do While Not rs.EOF
    frmDriverQuery.picDriverQuery.Print rs.Fields(0)
    'concatinate the remaining fields in the recordset to the end of the above statement (with & " " & rs.Fields(1), for example)
    rs.movenext
    loop

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