473,395 Members | 1,679 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,395 software developers and data experts.

Run Report Form Combo Box

I am trying to run a specific report from a combo box list. I typed in the report names my self to the list. I went to onclick and provided the following code:

Private Sub Report_Click()
DoCmd.OpenReport "Modification Monitoring Report", acViewReport
DoCmd.OpenReport "Special Servicing Loan Performance Report", acViewReport
End Sub

I need to be able to only open the report chosen by the drop down? Please help.
Jan 5 '12 #1
3 2060
ADezii
8,834 Expert 8TB
  1. Assuming a Combo Box named cboReports, populate cboReports with the Names of all Reports in the Database. Here, I chose to have this done in the Form's Open() Event.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Open(Cancel As Integer)
    2. Dim obj As AccessObject
    3.  
    4. With Me![cboReports]
    5.   .RowSourceType = "Value List"
    6.  
    7.    For Each obj In CurrentProject.AllReports
    8.      .AddItem obj.Name
    9.    Next
    10. End With
    11. End Sub
  2. Open the Selected Report in Preview Mode. This should be done in the AfterUpdate() Event of cboReports as indicated below.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub cboReports_AfterUpdate()
    2. If IsNull(Me![cboReports]) Then Exit Sub
    3.  
    4. DoCmd.OpenReport Me![cboReports], acViewPreview, , , acWindowNormal
    5. End Sub
Jan 5 '12 #2
I chose to have this done in the Form's Open() Event? Where do I do this? int he combo box's properties?
Jan 5 '12 #3
ADezii
8,834 Expert 8TB
Open Form in Design View ==> View ==> Properties ==> Select the Event Tab ==> On Open
Jan 5 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: El_Embozador | last post by:
Hi , please can you tell how i can print an MS ACCESS Report form visual basic, i ned a sample code .. Thanks
1
by: Peter | last post by:
Dear all, Could you give me a hint? a) I generate a report from a query table, then I want to use this report to show the total numbers of the customers who buy the goods. There is a string...
1
by: Samuel | last post by:
Why my Crystal Report form works on the machine I installed VB.NET, not works on the machine without VB.NET? Thanks.
0
by: neeraj | last post by:
Hi people's I developed One Windows application with some crystal Report I used my predefined crystal reports files for my application. I just take one crystal report viewer on form and set...
9
by: DeeMing | last post by:
I have created a form in Access, similar to a switchboard in which I want to print reports, and I can do this. However, I want to print based on particular parameters; i.e. I have 2 combo boxes on...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
12
by: Sol | last post by:
Hi gurus, I work for an oil company and need to fix an old DB, which used to work once. It will help us poor operators to do a safer job. What it does: When maintenance on a vessel is planned, the...
1
by: kkshansid | last post by:
i have some crystal reports but no related forms i made new simple form and copy pasted contents of a crystal report form to this new form and changed Dim Report As New CrystalReport6 according to...
30
by: vanlanjl | last post by:
Question: How do I create a Report based off the values/selections of mutliple combo boxes in a form? I have tried this several times with several failures and have used multiple codes to try...
2
by: guinb | last post by:
i have a form with 2 boxes for start date and end date as well as 2 combo boxes for serial number and aircraft type. if i select a specific value for each then the rerport is generated just fine but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.