PDA

Click to See Complete Forum and Search --> : How to print SQL???


Dillinger4
Sep 17th, 2000, 01:25 PM
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

JHausmann
Sep 18th, 2000, 01:43 PM
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