473,419 Members | 4,382 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Dialog Form for Report Not Working

I designed a dialog box with a combo to select individual vendors from
a form and its related data for print ouput. Though the dialog box
seems to work okay, I apparently do not have the filtering code behind
the OnOpen Event Procedure of the report structured correctly.
Anyone's assistance will be appreciated, although I would like to stay
on the same track.

Here is what I have done:

1. Created a new vendor query (qryVendorRpt) with only the needed
fields including the combo box (cboVendorsMain) from the main form
(frmMain).

2. Of course, created a new vendor report (rptVendorDetail).

3. Created a Dialog Form (frmVendorDialog) that contains the
(cboVendors) combo box with its RowSource set to the Vendors Table
(tblVendors). Also included on the Dialog Form is Cancel (cmdClose)
button and an OK (cmdOkay) button which is set to Me.Visible = False.

4. Then inserted code behind the OnOpen report Event Procedure. The
code below obviously is not working and needs to be tweaked.
Suggestions are welcomed.

5. I want to be able to choose "All Vendors" as well as optionally
choosing a single one for report output.

DoCmd.OpenForm "frmVendorDialog",,,,,acDialog

Me!Vendors = Forms![frmVendorDialog]![cboVendors]

DoCmd.Close acForm, "frmVendorDialog"

If Me!Vendors <> "All Vendors" Then

DoCmd.ApplyFilter , "[Me!Vendors]='" & Vendors & "'"

End If

A couple of error codes noted - 2448 can't assign a value to this
object, 2450 can't find form and a few more.

Thanks for your assistance.
Nov 12 '05 #1
1 4711
When you open a form in dialog mode, it pauses the current event until the
form is closed. That means your second line does not execute until after the
dialog form is closed. Once it's closed, the attempt to assign the value in
the form cannot work. Even if it did work, Report_Open is too early to
assign a value to a control.

You need to take another approach. Open the dialog first (not from
Report_Open). It does not need to be in design view. Then in the Click event
of the Ok button on your dialog, perform an OpenReport action. This way you
can use the WhereCondition of the OpenReport action to filter the report.
And if no specific vendor is chosen, don't apply a WhereCondition, so you
get all vendors.

Private Sub cmdOk_Click()
Dim strWhere As String

If Not IsNull(Me.cboVendors Then
strWhere = "Vendors = " & Me.cboVendors
End If

DoCmd.OpenReport "rptVendorDetail", acViewPreview, , strWhere
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html

"Dalan" <ot***@safe-mail.net> wrote in message
news:50**************************@posting.google.c om...
I designed a dialog box with a combo to select individual vendors from
a form and its related data for print ouput. Though the dialog box
seems to work okay, I apparently do not have the filtering code behind
the OnOpen Event Procedure of the report structured correctly.
Anyone's assistance will be appreciated, although I would like to stay
on the same track.

Here is what I have done:

1. Created a new vendor query (qryVendorRpt) with only the needed
fields including the combo box (cboVendorsMain) from the main form
(frmMain).

2. Of course, created a new vendor report (rptVendorDetail).

3. Created a Dialog Form (frmVendorDialog) that contains the
(cboVendors) combo box with its RowSource set to the Vendors Table
(tblVendors). Also included on the Dialog Form is Cancel (cmdClose)
button and an OK (cmdOkay) button which is set to Me.Visible = False.

4. Then inserted code behind the OnOpen report Event Procedure. The
code below obviously is not working and needs to be tweaked.
Suggestions are welcomed.

5. I want to be able to choose "All Vendors" as well as optionally
choosing a single one for report output.

DoCmd.OpenForm "frmVendorDialog",,,,,acDialog

Me!Vendors = Forms![frmVendorDialog]![cboVendors]

DoCmd.Close acForm, "frmVendorDialog"

If Me!Vendors <> "All Vendors" Then

DoCmd.ApplyFilter , "[Me!Vendors]='" & Vendors & "'"

End If

A couple of error codes noted - 2448 can't assign a value to this
object, 2450 can't find form and a few more.

Thanks for your assistance.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dalan | last post by:
The problem to resolve should be pretty easy for someone. I have a main form which contains a combo box to lookup various vendors. Have several reports for the vendors, but it is print all or...
1
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would...
4
by: dave | last post by:
I have an app that uses the OpenFile Dialog class. When I invoke the ShowDialog method, the hourglass appears and just stays. The dialog window never opens. I created a test form with an...
7
by: joseph.inglis | last post by:
I have a web browser object on a form which I have set to edit mode and use the UCOMIConnectionPointContainer interface to hook in and catch events. All working sweetly. Except there...
0
by: Mounilk | last post by:
I have a CrystalReportViewer(crv) on my form. I also have a dataset (dtsReportData) populated with the required data and i have a ReportDocument (rdReport) object. The data source for the crystal...
2
by: mounilkadakia | last post by:
I have a CrystalReportViewer(crv) on my form. I also have a dataset (dtsReportData) populated with the required data and i have a ReportDocument (rdReport) object. The data source for the crystal...
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
3
by: ARC | last post by:
Hello all, Using the following command, is there any way to get the printer dialog to open? I most packages, when you click print, it will open the printer dialog, however Access sends the...
2
by: J360 | last post by:
Access 2003/ XP Hi, I have a report that has its On Open event set to open a form in the style of a dialog box Private Sub Report_Open(Cancel As Integer) DoCmd.OpenForm...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.