Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use a string as output in a form???? PLEASE HELP!!!!!!!!

Status
Not open for further replies.

UWTechie

Programmer
May 24, 2001
18
0
0
CA
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....
 
Hi!

After you have your string built just say txtSql = sqlString. That should store the string in the text box.

hth
Jeff Bridgham

Note: You may need to change the field size of the text box if the sql from the queries total more than 255 characters. And, if the text box is bound to a field in a table, you will need to make the field a memo field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top