I'm trying to use the same subforms for two different mainforms. The first
main form is "frmSwaps" and the second main form is named "frmSwapsLive".
The recordsources for the subforms have parameters such as: [Forms]![frmSwaps]
![grpPayFixed]
So I have code in the On Open event of frmSwapsLive as follows:
strLive = "frmSwapsLive"
strTest = "frmSwaps"
frmName = frm.Name
If frm.Name = strLive Then blLive = True
Set db = CurrentDb
Set qdf = db.QueryDefs("qrySFrmPEData")
strSQL = qdf.SQL
If blLive Then
If InStr(strSQL, strLive) = 0 Then
strSQL = Replace(strSQL, strTest, strLive, , , vbTextCompare)
qdf.SQL = strSQL
End If
Else
If InStr(strSQL, strLive) > 0 Then
strSQL = Replace(strSQL, strLive, strTest, , , vbTextCompare)
qdf.SQL = strSQL
End If
End If
Set qdf = Nothing
I'm confident that this code will perform as advertised, but I never get
around to finding out, because before the code executes in the On Open event,
I get a series of parameter dialogs asking for "frmSwaps" parameters.
I was hoping that the qdf.sql would update before the subform had a chance to
try to run it's underlying query.
Any suggestions?
Thanks,
Bill
--
Bill Reed
"If you can't laugh at yoursel, laugh at somebody else"
Message posted via
http://www.accessmonster.com