Dialog & Combo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a dialog box (frmDialogTransactionsForMeeting) that contains a combo
box (MeetingDatecombo) looking up date values from a table.

A query (qryAllTransactions) that reports transactions against certain date
values, contains the following criteria on the MeetingDate field:

[Forms]![DialogTransactionsForMeeting].[MeetingDatecombo]

A report (rptTransactionsByMeeting) that calls the dialog box should report
activity for the date selected from the combo box. The report is based on the
query.

When running the report, the dialog box appears and I can select a value,
however I then get another prompt from the query for the MeetingDatecombo
value. The correct data is displayed in the report if I key in the date value
again but I don't want to have to do that, is there someting wrong here?
 
kmhnhsuk said:
I have a dialog box (frmDialogTransactionsForMeeting) that contains a
combo box (MeetingDatecombo) looking up date values from a table.

A query (qryAllTransactions) that reports transactions against
certain date values, contains the following criteria on the
MeetingDate field:

[Forms]![DialogTransactionsForMeeting].[MeetingDatecombo]

A report (rptTransactionsByMeeting) that calls the dialog box should
report activity for the date selected from the combo box. The report
is based on the query.

When running the report, the dialog box appears and I can select a
value, however I then get another prompt from the query for the
MeetingDatecombo value. The correct data is displayed in the report
if I key in the date value again but I don't want to have to do that,
is there someting wrong here?

Are up opening the dialog form BEFORE opening the report or are you trying
to have the report open it? If the latter I believe you would have to
remove the RecordSource of the report and then set it in the open event
after opening the form. Otherwise it is going to look for the form before
you have run the line of code that opens it.
 
Yes it is the latter and if I remove the recordsource from the report then it
runs okay but none of the fields or data is displayed - it is replaced with
name? and error? values as it cannot determine what the fields and data are
without a recordsource
--
Kevin


Rick Brandt said:
kmhnhsuk said:
I have a dialog box (frmDialogTransactionsForMeeting) that contains a
combo box (MeetingDatecombo) looking up date values from a table.

A query (qryAllTransactions) that reports transactions against
certain date values, contains the following criteria on the
MeetingDate field:

[Forms]![DialogTransactionsForMeeting].[MeetingDatecombo]

A report (rptTransactionsByMeeting) that calls the dialog box should
report activity for the date selected from the combo box. The report
is based on the query.

When running the report, the dialog box appears and I can select a
value, however I then get another prompt from the query for the
MeetingDatecombo value. The correct data is displayed in the report
if I key in the date value again but I don't want to have to do that,
is there someting wrong here?

Are up opening the dialog form BEFORE opening the report or are you trying
to have the report open it? If the latter I believe you would have to
remove the RecordSource of the report and then set it in the open event
after opening the form. Otherwise it is going to look for the form before
you have run the line of code that opens it.
 
kmhnhsuk said:
Yes it is the latter and if I remove the recordsource from the report
then it runs okay but none of the fields or data is displayed - it is
replaced with name? and error? values as it cannot determine what the
fields and data are without a recordsource

Read my first reply again. I said you would have to remove the RecordSource
property and ALSO set it in the Open event of the report after the form has
been opened.

Me.RecordSource = "TableOrQueryName"
 
Apologies, I have added this to the open event, which also has the code for
the dialog form opening:

Private Sub Report_Open(Cancel As Integer)
'Open Meeting Transactions Dialog Form
'IsLoaded function (defined in Utility Functions module) determines
'if specified form is open.

Dim strDocName As String
Me.RecordSource = "qryAllTransactions"

strDocName = "frmDialogTransactionsForMeeting"
'Set public variable to True so Meeting Transactions Dialog Form knows
that
'report is in its Open event.
blnOpening = True

'Open form.
DoCmd.OpenForm strDocName, , , , , acDialog

'If Meeting Transactions Dialog Form isn't loaded, don't preview or
print report.
'(User clicked Cancel button on form.)
If IsLoaded(strDocName) = False Then Cancel = True

'Set public varaible to False, signifying that Open event is finished.
blnOpening = False
End Sub

When opening the form, the dialog box appears okay and I can select a date,
but I get the same parameter box again for the query.
 
Back
Top