B
BruceM
I have read that one of the ways to improve performance is to set a form's
record source in the Load event rather than by setting the Record Source
property. Do I understand correctly, and are there caveats to this
approach?
If this approach makes good sense, I am wondering about which approach to
take to open a form (I will call it frmTwo) to a particular record that
corresponds to the current record on the main form. Should the WHERE
condition be part of the recordsource SQL in the Load event for frmTwo?
dim strSQL as String
strSQL = "SELECT MainID, TwoText FROM tblTwo " & _
"WHERE MainID = " & Forms!frmMain!MainID
Me.RecordSource = strSQL
Or should the recordsource SQL be thus:
dim strSQL as String
strSQL = "SELECT MainID, TwoText FROM tblTwo "
Me.RecordSource = strSQL
with the specific record code in the OpenForm action?
DoCmd.OpenForm "frmTwo", , , "[MainID] = " & MainID
In either case the frmTwo is being opened from a command button on frmMain.
If setting the record source at runtime is a worthwhile approach, is the
Load event the place to do that? If there are related comments or
observations I did not raise with my specific questions I would appreciate
hearing about them.
record source in the Load event rather than by setting the Record Source
property. Do I understand correctly, and are there caveats to this
approach?
If this approach makes good sense, I am wondering about which approach to
take to open a form (I will call it frmTwo) to a particular record that
corresponds to the current record on the main form. Should the WHERE
condition be part of the recordsource SQL in the Load event for frmTwo?
dim strSQL as String
strSQL = "SELECT MainID, TwoText FROM tblTwo " & _
"WHERE MainID = " & Forms!frmMain!MainID
Me.RecordSource = strSQL
Or should the recordsource SQL be thus:
dim strSQL as String
strSQL = "SELECT MainID, TwoText FROM tblTwo "
Me.RecordSource = strSQL
with the specific record code in the OpenForm action?
DoCmd.OpenForm "frmTwo", , , "[MainID] = " & MainID
In either case the frmTwo is being opened from a command button on frmMain.
If setting the record source at runtime is a worthwhile approach, is the
Load event the place to do that? If there are related comments or
observations I did not raise with my specific questions I would appreciate
hearing about them.