Results 1 to 7 of 7
  1. #1
    jscalem is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    11

    Transfer Form name to subform

    I'm not sure exactly where this would go. I have a form called Audit on there is a button that opens the subform Feedback. I would like the Feedback form to open with one field populated with the name of the form they clicked the feedback button on.



    For example if they click "Feedback" on the "QC Screen" the feedbck submission form would open with "QC Screen" populated in the Process Field box.

    Is this possible without having to do every screen separate??

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    One way is to use OpenArgs argument of OpenForm. Then opening form code reads OpenArgs property to get info.

    But I am confused. You say there is a Feedback subform but the Feedback form is opened independent?

    DoCmd.OpenForm "Feedback", , , , , acDialog, Me.Name

    Instead of Me.Name, can use whatever literal text you want to pass, such as: "QC"

    Then code behind Feedback, perhaps in Current event:

    If Me.NewRecord Then
    Me.tbxProcess = Me.OpenArgs
    End If
    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.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Depending on how you named your forms, the form caption might be of more use, as in Me.Caption
    Then again, literal text is good too.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    jscalem is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    11
    So I have various forms (Leadership, QC, Auditor, etc etc) on each form I want to put a button that opens a feedback submission form. In the feedback form that pops up to add to the feedback table I need it to populate the name of the form where the hit the feedback button. This way I can see what form they had feedback. So if they pressed feedback on the QC screen the feedback form would open to add a new entry and in the form field would populate "QC Form". I don't want it to have to have the name of the form within each button. I want to design one button that can be used on any form without changing anything.

    Quote Originally Posted by June7 View Post
    One way is to use OpenArgs argument of OpenForm. Then opening form code reads OpenArgs property to get info.

    But I am confused. You say there is a Feedback subform but the Feedback form is opened independent?

    DoCmd.OpenForm "Feedback", , , , , acDialog, Me.Name

    Instead of Me.Name, can use whatever literal text you want to pass, such as: "QC"

    Then code behind Feedback, perhaps in Current event:

    If Me.NewRecord Then
    Me.tbxProcess = Me.OpenArgs
    End If

  5. #5
    jscalem is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2017
    Posts
    11
    How exactly would I do this??

    Quote Originally Posted by Micron View Post
    Depending on how you named your forms, the form caption might be of more use, as in Me.Caption
    Then again, literal text is good too.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    Then use Me.Name or Me.Caption as suggested.
    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.

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Cannot tell if (Leadership, QC, Auditor, etc etc) should be one form or not, but the way I read the rest of it, likely the feedback form should be one form only, regardless of what form opens it. The test for this would be that if the feedback form looks almost the same to the user regardless of which of the "main" forms they're on, then as a rule, don't create a form for every type of feedback.

    In that case, I'd have one function in a standard module and call that function from every main form button click (just the forms involved in this). The button click would pass the main form caption to the function. The function would open the feedback form (there is only one) and pass the caption as the Open Args as already pointed out. The user would then enter their comments and upon saving, the form caption (retrieved from Open Args) and the comments would be appended to the correct table. I suppose a select case block would decide which query (or vba sql) to run, based on the form caption. Alternatively I suppose the feedback form sql could be set from the called function, but I'm not seeing any preference for one or the other method at present.

    Otherwise, you're repeating virtually the same code in every main form button click as well as in every comments form that relates to the main form that opens it.

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

Similar Threads

  1. Transfer data from one form to another
    By sparker75 in forum Macros
    Replies: 1
    Last Post: 09-07-2018, 03:25 PM
  2. Transfer data from a subform
    By anchamal in forum Forms
    Replies: 6
    Last Post: 10-19-2016, 04:40 PM
  3. Replies: 4
    Last Post: 02-19-2014, 03:32 PM
  4. Replies: 3
    Last Post: 06-19-2013, 02:39 PM
  5. Transfer ID from Form to Query Subform field
    By smcfadden777 in forum Forms
    Replies: 4
    Last Post: 03-11-2012, 08:06 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