After many hours of frustrating attempts and twists to get a dialog
box to work as intended, I turn to the resident gurus of MSAccess
matters for assistance. I'll try to make this quick and painless as
possible.
The Access 97 database has a Dialog Box (frmDialog) and an unbound
Combo Box although the reverse produced the same results (cboName).
The Row Source is: Select DistinctRow qryOrders.CoName From qryOrders
Order By qryOrders.CoName. I have changed the order and names many
times and also used different tables and queries, but no change in
outcome.
The OK command button on frmDialog has an event procedure behind as
follows:
Dim strWhere As String
If Not IsNull(Me.cboName) Then
strWhere = "qryOrders" = " & Chr(34) & Me.cboName & Chr(34)
End If
docmd.OpenReport "Orders", acViewPreview,,strWhere
The report Record Source uses the same query and on the OnOpen event
procedure the following code used:
Dim strDocName As String
strDocName = "frmDialog"
docmd.openForm strDocName,,,,,acDialog
docmd.Close acForm, strDocName
The combo box does list all companies and if left blank (no selection
in box), and after clicking OK button the report appears with all data
- looks fine. However, if a specific company is selected, there is an
Enter a Parameter Value popup box displayed that shows the name of the
query (qryOrders) or table used (this is the problem). Have tried
several different ones, no change. Have no clue what it is asking for
and it should not be displayed anyway. Doesn't matter if a value is
provided or not as the preview of the report is blank.
I know that the above does work as I had used it several months ago on
another database. But why it fails to work on a different one is worth
finding out. Any assistance will be appreciated. Thanks, Dalan