Results 1 to 4 of 4
  1. #1
    GaryG73 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    2

    Reports and Forms

    I am working with MS Access 2010.
    I have created an unbound form that when clicked opens a query with a combo box drop-down menu. When an item is selected from the menu, the query retrieves the records that match the menu selection.
    I am now trying to create a report that connects to the form and query. I created a macro that opens the form however it continues on to the query without waiting for the combo box selection. Since the combo box is blank, the report comes back with headers but no data. How can I fix this? Thank you.

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Post your code to run the report. You will need to add a line of code to request input on the parameter for the query. Need to see what you have in order to determine what is not working.

  3. #3
    GaryG73 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    2

    Code

    I think this is what you requested. The first Macro opens the form. The second opens the query and resets it to a "blank" after the query has been run. Thanks for your help.

    Option Compare Database

    '------------------------------------------------------------
    ' DegreeReport
    '
    '------------------------------------------------------------
    Function DegreeReport()
    On Error GoTo DegreeReport_Err

    DoCmd.OpenForm "SPC AS Degree Programs", acNormal, "", "", , acNormal


    DegreeReport_Exit:
    Exit Function

    DegreeReport_Err:
    MsgBox Error$
    Resume DegreeReport_Exit

    End Function


    Option Compare Database

    Private Sub Combo0_Change()
    DoCmd.OpenQuery "Approvals by SPC AS Degree Program"
    Me.Combo0 = " "
    End Sub

    Private Sub SPC_Degree_Programs_Change()

    End Sub

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Ok. Those look ok. Where is your code to open and run the report?

    Also in the query, what does the SQL statement look like? Does it have a reference to the Form for the criteria from the combo box? I'm guessing that it does.

    I'm thinking that you need a line of code that says something like this:

    If me.combo0="" Then
    MsgBox ("Make a Selection")
    Else
    DoCmd......

Please reply to this thread with any new information or opinions.

Similar Threads

  1. reports to forms to queries
    By aaa1 in forum Forms
    Replies: 9
    Last Post: 08-10-2011, 07:29 PM
  2. Forms and reports
    By g2rules in forum Access
    Replies: 0
    Last Post: 03-08-2011, 09:09 AM
  3. Queries, Forms, Reports..
    By groundhog in forum Access
    Replies: 3
    Last Post: 07-07-2010, 12:30 PM
  4. Forms and Reports
    By nacho in forum Forms
    Replies: 3
    Last Post: 04-17-2010, 01:06 AM
  5. Emailing forms or reports
    By dcecil in forum Reports
    Replies: 6
    Last Post: 12-16-2009, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums