Results 1 to 4 of 4
  1. #1
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53

    Non-Saved user defined fields for reports

    Hello,



    I have a form with a button which will generate a report based on the specific record open in the form. Every time a user generates this report, I want pop up message boxes to ask a few specific questions to populate fields in the report.

    However, I do not need the answers to the pop up message boxes to be saved in any table as they will be different every time the report is generated.

    How do I create pop up message boxes the user fills out, they populate fields in the report, and once the report is printed and closed the user data is erased?

    Thank you

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Typically, I will get user input from comboboxes. MsgBoxes are either yes or no responses. You could ask a series of yes no questions and store the answers in variables. The best way would be to store the answer to the Msgbox in an integer but you could store it in a string variable or variant type also.

    Here is an example of a MsgBox that would get user input and store it in a variable named "Response2" you could have Response1, Response2, Response36, etc.

    Code:
        Dim Msg2, Style2, Title2, Response2 'Make some declarations
        Msg2 = " Access wants to know the answer. Is it Yes or No?  "   'Define message
        Style2 = vbYesNo + vbInformation + vbDefaultButton1    ' Define buttons.
        Title2 = "Question"    ' Define title.
        Response2 = MsgBox(Msg2, Style2, Title2) 'This is where the message box pops up for the user
        
        'Now you need to handle the user input
        'The user has two options in this case
        'Yes or No. We will handle the input with an
        'If Then Else statement
        
        If Response2 = vbYes Then    ' User chose Yes.
        MsgBox "Congratulations, you chose Yes. "
        Else
        MsgBox "You chose No. Goodbye! ", vbInformation, "Action Stopped"
        Exit Sub
        End If

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,795
    I think user entry to unbound controls on form will be the easiest. Textboxes on the report can refer to the controls on the open form. Open and print report, close form, no data saved. No code required, unless you want to validate user input.

    Another way to get user input is with popup parameters in a query that is report RecordSource. However, I don't use input popups because it is very hard, if not impossible, to validate user input.

    There are other ways to pass values to report but are more complex.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53
    Works perfect using unbound controls in a form. Thank you for the help!

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

Similar Threads

  1. Replies: 3
    Last Post: 11-12-2013, 04:13 PM
  2. user-defined type not defined
    By markjkubicki in forum Programming
    Replies: 3
    Last Post: 05-09-2013, 05:15 PM
  3. Replies: 1
    Last Post: 12-14-2012, 12:32 AM
  4. Where to start: user defined reports
    By noweyout in forum Reports
    Replies: 2
    Last Post: 04-22-2011, 01:23 PM
  5. Error: "User-defined type not defined"
    By mastromb in forum Programming
    Replies: 10
    Last Post: 01-08-2010, 02:57 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