SQL in VBA

mr moe

Registered User.
Local time
Today, 21:36
Joined
Jul 24, 2003
Messages
332
I wrote a long sql in a form, I have a button, I want to click on the button and have the sql run the subform.

so basically i'm trying to make the sql in vba run for a subform. can someone help me please.
 
If the SQL is not stored, there are limits to how long the string can be. However, if it doesn't overflow those limits, you can open the subform with that SQL as its recordsource. There is a {formname}.Recordsource property you load that to. However, it has been a while since I'e done this. I think you have only 255 characters in the string that results from just loading the SQL statement to the recordsource property. There is also the little matter that the query had better provide all the fields the form needs or you invite even more confusion.
 
Dim sql as string
sql = "SELECT..."
Me.[subform].Form.RecordSource = sql
 

Users who are viewing this thread

Back
Top Bottom