Results 1 to 11 of 11
  1. #1
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48

    Help on Generating a Report!

    Hi,

    I have spent much of my time creating form and have become versatile in form processing, etc. But now I have to create reports for the software that I am developing... and it looks like the learning curb is starting all over again. I have search the internet, but only get the basics of creating a report which I know how to do. Here is my situation...

    I create a table of daily transactions, i.e. when user closes the business day it writes transactions to the transaction file. I then created a report menu and when a selection is made, I open a pop-up form when parameter selections. Based on the parameter selection, I do a search on the transaction file to ensure that there are records, if no records I give a message, if there are records I open the report passing the parameter selection that was enter. Code below:

    Dim rs As DAO.Recordset



    If Not IsDate(Me.FromDate) Then Me.FromDate = Date
    If Not IsDate(Me.ToDate) Then Me.ToDate = Date

    If strP1 <> "0" And strP2 = "0" And strP3 = "0" _
    And strP4 <> "0" And strP5 <> "0" And strP6 <> "0" Then

    strSQL = "SELECT * FROM tblCloseBusTrans WHERE [BefDepartment] = '" & Me.cboDept & "' AND " & _
    "[BusDayDate] >= #" & Me.FromDate & "# AND " & "[BusDayDate] <= #" & Me.FromDate & "#"

    strLinkCriteria = "[tblCloseBusTrans].[BefDepartment] = '" & Me.cboDept & "'" & _
    "AND [tblCloseBusTrans].[BuyBusDate] >= #" & Me.FromDate & "#" & _
    "AND [tblCloseBusTrans].[BuyBusDate] <= #" & Me.ToDate & "#"

    End If

    Set rs = DBEngine(0)(0).OpenRecordset(strSQL)
    If rs.EOF = True Then
    MsgBox "No Records for selected criteria"
    strLinkCriteria = ""
    Exit Sub
    End If
    rs.Close
    Set rs = Nothing

    DoCmd.OpenReport strForm, , , strLinkCriteria, , , strSndArgs & "," & strForm

    When I Click the OK button, it pops up a messaging that it is printing the report to the printer and just hangs.

    What I would like to do, is let the form first open in preview mode so that the user can see the report online and then decides whether they want to print the report or not. It must not print when I open the report, but open in preview mode.

    Your help is much appreciated.

    Thanks
    Earl

  2. #2
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48
    OK.. changed the docmd as follows as it was opening in report view

    DoCmd.OpenReport strForm, acViewPreview, , strLinkCriteria, acWindowNormal, strSndArgs

    now it opens the form, but with other issues...

    1. The report opens behind my form the are open - how do I get the report to be the current window on my screen. I have to close all my forms to get the the report.

    2. There are no Options available to print, set the margins, close, etc... I know the code I inserted in the login screen must have something to do with this... I created a module to Hide the Access Tools when a user signs in so that they do not have access to the tables, forms, reports in designer view of manipulate the data in the table.

    Pleeeeeeease help

  3. #3
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    What is strform?

    To preview report in view mode use:
    DoCmd.OpenReport ("strForm") ,acViewPreview , , strLinkCriteria, , , strSndArgs & "," & strForm

    The report name should be enclosed in quotation marks ("strform")

  4. #4
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    To just hide your form, add this line of code after the open report code:

    Forms![yourFormnameHere].Visible = False

  5. #5
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48
    Hi Khalid,

    I have a table called formName and in this table, I put all the forms that I use, and use code to access the form that the process requires. Attached to the form is a report name as well, so when I select Stock Details by Dept, it passes the data to the parameter selection form and once the parameters have been entered and the user clicks ok, it already knows which form to use, thereby avoiding hardcoding in the program.

    I know it opens the correct report, but my previous post to my own thread indicated that I changed the docmd command to open in preview and not report. I now have additional problems that is not related to my original thread.

    Earl

  6. #6
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    What the additional problem you face now???

  7. #7
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48
    Here is my process..

    1. frmLogin Opens frmStartup
    2. In frmStartup on the open event I clode frmLogin
    3. frmStartup gives the user menu options to select. I do not close this form, as the user can exit from other forms and land up back at the Main Menu and then logoff.
    4. One of the option in (3) is to print reports, when this is clicked, a report menu form open (frmstartup1).
    5. in frmstartup1 (report menu) user has various options, when a selection is made it opens frmStockParms and does not close form opened in (4), as the user can then make another selection after they entered the parameters for the report.
    6. Once the selection criteria is entered and the user clicks ok, it opens the report.

    The problem I had was as follows:

    1. report is opening behind the forms that are open for a reason. I inserted the code you suggested, and the selection form closed, but not the frmstartup1 or frmstartup and the report still hides behind these forms. I then proceeded to insert this code in the frmstartup1 and frmstartup, but when I login in and click the selection on frmstartup I am sitting with a blank screen and since I disabled all the access tools, I have to use the task Manager to close access and then use SHIFT + Access to open the database in Designer View.

    Hope this explains the problem.

    Earl

  8. #8
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    1. report is opening behind the forms that are open for a reason. I inserted the code you suggested, and the selection form closed, but not the frmstartup1 or frmstartup and the report still hides behind these forms. I then proceeded to insert this code in the frmstartup1 and frmstartup, but when I login in and click the selection on frmstartup I am sitting with a blank screen and since I disabled all the access tools, I have to use the task Manager to close access and then use SHIFT + Access to open the database in Designer View.
    Hope this explains the problem.

    Earl[/QUOTE]

    I am wonder if your form Modal property is set to Yes:
    The Modal property to specify whether a form opens as a modal (modal: A window or dialog box that requires the user to take some action before the focus can switch to another form or dialog box. Dialog boxes and messages are usually modal.) window. When a form opens as a modal window, you must close the window before you can move the focus (focus: The ability to receive user input through mouse or keyboard actions or the SetFocus method. Focus can be set by the user or by the application. The object that has focus is usually indicated by a highlighted caption or title bar.) to another object. Read/write

    if it is yes, set it to No, another thing you should decide when to un-hide your hided form to show up to the user? hiding just a form to view report on a full widow is good idea, but not recommended. The report should automatically be viewed on docmd.opendReport command and should be on the top of the screen.

    goto form other property and check for Popup and Modal.

  9. #9
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48
    I searched the net and suggestions is pointing in the direction of modal and pop-up. I will do some research on the modal ad pop-up forms and hopefully I can resolve the issue.

    Thanks a mill

  10. #10
    ETCallHome is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Mar 2011
    Location
    Limpopo, South Africa
    Posts
    48
    Ok... playing around with the Modal and Popup form proprties did the trick, but the report is opening as a 1/4 of the screen, need it to display the full screen with a custom ribbon, i.e. just the basic ribbon... I will search for topics relating to custom ribbons in the meantime.

    Thanks for all you input.
    Earl

  11. #11
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    You can use:
    DoCmd.Maximize code to view your report on full screen.

    Good Luck!

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

Similar Threads

  1. Generating Email through Access
    By rsteph49 in forum Access
    Replies: 1
    Last Post: 05-02-2011, 11:31 AM
  2. Generating report from fields chosen in a form
    By kroenc17 in forum Reports
    Replies: 19
    Last Post: 10-01-2010, 10:38 AM
  3. Form using requerys and report generating
    By kroenc17 in forum Forms
    Replies: 1
    Last Post: 09-22-2010, 07:12 AM
  4. Generating Report from Form
    By mwabbe in forum Reports
    Replies: 8
    Last Post: 08-30-2010, 12:25 PM
  5. noob prob, generating next report
    By flash319 in forum Reports
    Replies: 2
    Last Post: 08-04-2008, 03:10 PM

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