Results 1 to 6 of 6
  1. #1
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13

    Passing parameter between 2 forms

    So I'm making a customer search form in a modal dialog view where you can search the customer based on their name or other details and then it will show up in a query object frame. This search form will be opened from other form, so the idea is when the search form is closed, the customer ID value will be passed to the other form. Unfortunately I don't know how to make that happened, and most thing I found on google show more of opening new form and passing value to them instead of the other way around.



    And on a side note, based on design or praticality, is it better to use object frame or other kind of subform when inserted into another form?

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I don't completely understand your use of terminology - a query object frame?
    Opening "a new form" is exactly what you want, but apparently, you need to effect this in the Close Event of the dialog form. So you can either pass an OpenArg or a filter to the Docmd.OpenForm event for the new form. I seem to have more luck with the arg method. You could simply pass the CustomerID in the arg and apply it as a filter in the open event of the new form.
    And on a side note, based on design or praticality, is it better to use object frame or other kind of subform when inserted into another form?
    Used for what? Bound/Unbound frame controls are not meant for sub forms or sub reports. Use a sub form or sub report control for that.
    You might want to review this if you're needing a search form
    http://allenbrowne.com/ser-62.html
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13
    Hi Micron, thanks for your reply. So I've tried your solution, after some testings it does show that it passes the value to the larger form from the search form. However, I don't know which event in the larger form should I use so it will automatically update the control box that I want to change. I've tried on got focus and on open, but it doesn't trigger. So I guess Docmd.OpenForm doesn't work as effective if said form is already opened.

    Quote Originally Posted by Micron View Post
    Used for what? Bound/Unbound frame controls are not meant for sub forms or sub reports. Use a sub form or sub report control for that.
    You might want to review this if you're needing a search form
    http://allenbrowne.com/ser-62.html
    I'm still relatively new with access, so I do get mixed up with stuffs sometimes and use "dirty" method. Anyway, thanks for the link, now I have redesign the form accordingly so it looks much nicer.

  4. #4
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I don't know which event in the larger form should I use so it will automatically update the control box that I want to change.
    Either the report open or load event should suffice. I don't know what you did since you didn't post what you tried (see bullet #1 in my signature).
    So if it's the open arg method: Me.controlName=Me.OpenArgs You never mentioned you would want this to work if the results form was already open. Suggest you research form objects and their relationships to other parts of the db. It's a simple task to affect any form control (that allows it) from another form: Forms!frmName.ControlName. Hopefully you realize you have to substitute your own object names for the ones I use.

  5. #5
    Skarvion is offline Novice
    Windows 10 Access 2013
    Join Date
    Jan 2016
    Posts
    13
    Quote Originally Posted by Micron View Post
    Suggest you research form objects and their relationships to other parts of the db. It's a simple task to affect any form control (that allows it) from another form: Forms!frmName.ControlName. Hopefully you realize you have to substitute your own object names for the ones I use.
    That one works much better than passing parameters, I didn't realize this option. Thank you for your help. Sorry if I didn't post my working.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    No worries, and good luck!

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

Similar Threads

  1. Passing parameter between forms
    By jamedadi in forum Forms
    Replies: 5
    Last Post: 11-11-2013, 02:53 PM
  2. Replies: 2
    Last Post: 05-06-2012, 03:52 PM
  3. Parameter Passing
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 11-21-2011, 10:23 AM
  4. Passing List of Parameter
    By vignes10 in forum Access
    Replies: 3
    Last Post: 09-15-2011, 07:35 AM
  5. Macro passing a parameter
    By SlowPoke in forum Access
    Replies: 1
    Last Post: 09-26-2010, 09: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