K
karen scheu via AccessMonster.com
I have a problem viewing a mainform/subform when setting the rowsource
dynamically .
I have a filter form which allows user to enter begin date and end date range
, a division and a customer. There is a view button on this form that will
create a where string based on the user selections, then open the mainform.
The following code shows example of how I set the recordsource and open the
form
strWhere = "[minOfGl] Between #" & Me!BeginningDate & "# AND #" & Me!
EndingDate & "# " & _
" AND [div_code]= " & txtDiv & " AND [firstOfSDAN8]= " &
txtCust
DoCmd OpenForm "Frm201Main"
With Forms![frm201main]
.RecordSource = "Select * FROM Qrpt201Summary WHERE " & strWhere
Me.Requery
!cboOrder.RowSource = "Select DISTINCT [SDDOCO], [SDDCTO] FROM
Qrpt201Summary WHERE " & strWhere _
& " ORDER BY [SDDOCO]"
!cboOrder.Requery
End With
When the mainform opens, it opens with the first row from the Qrpt201Summary
query result before the where string was applied, then a few seconds later,
the forms are refreshed and the mainform and subform display the filtered
selection. How can I change things so that the forms do not open until the
where clause is applied?
Thanks so much for any assistance with this.
dynamically .
I have a filter form which allows user to enter begin date and end date range
, a division and a customer. There is a view button on this form that will
create a where string based on the user selections, then open the mainform.
The following code shows example of how I set the recordsource and open the
form
strWhere = "[minOfGl] Between #" & Me!BeginningDate & "# AND #" & Me!
EndingDate & "# " & _
" AND [div_code]= " & txtDiv & " AND [firstOfSDAN8]= " &
txtCust
DoCmd OpenForm "Frm201Main"
With Forms![frm201main]
.RecordSource = "Select * FROM Qrpt201Summary WHERE " & strWhere
Me.Requery
!cboOrder.RowSource = "Select DISTINCT [SDDOCO], [SDDCTO] FROM
Qrpt201Summary WHERE " & strWhere _
& " ORDER BY [SDDOCO]"
!cboOrder.Requery
End With
When the mainform opens, it opens with the first row from the Qrpt201Summary
query result before the where string was applied, then a few seconds later,
the forms are refreshed and the mainform and subform display the filtered
selection. How can I change things so that the forms do not open until the
where clause is applied?
Thanks so much for any assistance with this.