G
Guest
Is it possible to execute a string variable as a VB statement?
Robert said:Is it possible to execute a string variable as a VB statement?
Robert said:I am trying to set the record source of a subform on a form but the
same needs to run for two different forms. I was hopeing to pass the
form name and concatenate it to the string and execute the string.
I.E. "Forms!" & formname & "!subformname.form.recordsource=select x
from tablex"
Dirk Goldgar said:If it's just the form name you want to get from a variable, you're in
luck. This works:
Dim strFormName As String
strFormName = "frmFoo"
Forms(strFormName)!YourSubformName.Form.RecordSource = _
"SELECT X FROM TableX"
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)