Results 1 to 14 of 14
  1. #1
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28

    Universal Form for different sources

    I have an option group where the user reads a question and either has to select yes or no. There are multiple questions on this form. If the user selects 'No' I'd like a "why" form to pop up and allow the user to write a reasoning down and have it saved in a record in a table (the same table that the yes or no answer is saved in).



    Right now I have it working, but my method will force me to make a specific why form for each question (which will be over 50). This doesn't seem very efficient.

    Is there a way to have a universal 'why' form pop up when 'no' is selected for each question?

    If anything doesn't make sense, let me know and I'll explain further.

    Thanks!
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Probably, but it would help to know your structure. Offhand you can probably adapt this:

    http://www.baldyweb.com/WrappedForm.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28
    I've attached an example database. If you go to the Questions form and select the "No" option, it should open the "Why" form up. This the is the form i want to be universal to work for both those questions and save the record separately in that table.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    There is no attachment. If you didn't already, try compacting the db and then zipping it before attaching here.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28
    Sorry, I attached it to the original post not the reply. I also attached it again to this reply.
    Attached Files Attached Files

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Duh, I didn't look up that far. Feel free to say "hey dummy, look up!"

    Your design isn't normalized, and you may have trouble with it in the future. I've never done a survey/questionnaire db, but I've heard this is a good sample:

    http://www.rogersaccesslibrary.com/f...ey_topic3.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28
    I will look at that survey database. But I'm not really creating a 'survey' perhaps, but a checklist. I work at a manufacturing plant and they have to go through this checklist and say yes or no if something was done for a process. Right now if they say no, there's no 'reason' field on the paper version and there's no accountability so pencil whipping is prevalent. The feature I'm trying to accomplish would force them to put a reason if no was the answer because they couldn't move forward in the database without stating a reason something was not done or whatever and thus making that 'why' form disappear so they could move on to the next item on the checklist.

  8. #8
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    If you don't expect or require a great deal of explanation, you could use the InputBox function to get the answer. It takes a question as a parameter, and you can specify the window title as well. Because it is a function, you can put the result straight into a variable or form field:

    strReason = inputbox("Please indicate the reason(s) for...","Window title")

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Quote Originally Posted by theperson View Post
    I will look at that survey database. But I'm not really creating a 'survey' perhaps, but a checklist.
    The principle is similar though. If you get a new checklist item, it shouldn't require a redesign of forms, reports, etc. Yours will.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28
    So I put that inbox box code in for the no option in the Questions form. It works but I'm confused as to where the response to the inputbox goes. I'm currently googling to learn about input boxes but maybe you could explain better quicker.

    In my attachment to this reply, when no is selected in the why1 option group and the inputbox pops up, I want that answer to go to the why1 field in the table (or form if we need it to go into form version before it gets saved into the table). How can I make that work?

    Thanks!
    Attached Files Attached Files

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    The expectation would be that there would be a textbox bound to the reason field, and you would put the answer there:

    Me.TextboxName = InputBox(...)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    To put it into a form field, just use the form control name instead of the variable strReason:

    me![why1] = inputbox("Please indicate the reason(s) for...","Window title")

    If the control is bound to a table field, you don't need to do anything else, otherwise you will need a bit of VBA code. Where do you want to keep the "reason" responses?

  13. #13
    theperson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    28
    I think it worked! I used the following code:

    strReason = InputBox("Please indicate the reason(s) for...", "Window title")
    DoCmd.OpenForm "Table", acNormal, "", "", acEdit, acHidden
    DoCmd.GoToRecord acForm, "Table", acLast
    Forms!Table!why1 = InputBox("Please indicate the reason(s) for...", "Window title")

    It probably doesn't make sense but for a lot of what I do for information input into an access field I open a form that records information to a table of the same name. I'm not sure of a better way to do it since access is a self-learned skill I've been learning overtime.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You already have a form open to that record, so why not just add a textbox to that form? It can be hidden.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Modified Universal Search
    By orange in forum Code Repository
    Replies: 4
    Last Post: 02-08-2017, 02:14 PM
  2. Replies: 7
    Last Post: 08-22-2014, 05:10 PM
  3. Universal Search
    By drunkenneo in forum Programming
    Replies: 1
    Last Post: 05-28-2014, 06:08 AM
  4. Universal Search
    By Douglasrac in forum Access
    Replies: 3
    Last Post: 05-20-2011, 06:25 PM
  5. Manipulating Form&Query Sources
    By dinorbaccess in forum Forms
    Replies: 3
    Last Post: 12-30-2010, 11:11 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