This is the code that I have which will get the sql from all the queries in a table, and then put it into a string
Sub sqlRetriever
Dim qDef As QueryDef
Dim sqlString As String
Dim qCnt As Integer
qCnt = CurrentDb.QueryDefs.Count
For i = 0 To (2)
Set qDef = CurrentDb.QueryDefs(i)
sqlString = sqlString + (qDef.Name + Chr(13))
sqlString = sqlString + (qDef.SQL + Chr(13) + Chr(13))
Next i
End Sub
I need to get the sqlString into a form, so that I can then export it to Excel, but linking to the form itself... But I HAVE NO IDEA how to get the string into the form... Not a bloody clue... I have tried everything...
ObjectName.Print sqlString, Me.txtSql = sqlString, etc...
Nothing has worked... Please help me, and try to be very explicit in what I should do, because i have never used VB before... thank you very much....
Sub sqlRetriever
Dim qDef As QueryDef
Dim sqlString As String
Dim qCnt As Integer
qCnt = CurrentDb.QueryDefs.Count
For i = 0 To (2)
Set qDef = CurrentDb.QueryDefs(i)
sqlString = sqlString + (qDef.Name + Chr(13))
sqlString = sqlString + (qDef.SQL + Chr(13) + Chr(13))
Next i
End Sub
I need to get the sqlString into a form, so that I can then export it to Excel, but linking to the form itself... But I HAVE NO IDEA how to get the string into the form... Not a bloody clue... I have tried everything...
ObjectName.Print sqlString, Me.txtSql = sqlString, etc...
Nothing has worked... Please help me, and try to be very explicit in what I should do, because i have never used VB before... thank you very much....