locked
Control Source for a field from two independent forms, possible? RRS feed

  • Question

  • Hi,

    I've been working on a form-based work-order documentation system, and I have run into a bit of a snag. I have set up a couple of forms that start from the same original form, but diverge based on an user's decision. However, I'd like to have a summary of these decisions posted on the same form at the end, regardless of which "direction" they went in the beginning.

    To put it shortly, my employees can search for old orders on Form A, with two different search options. They can either select the record directly and be taken to Form C with this info used to fill this form, or, if they can't remember certain infos, they will be taken to Form B, where they can refine their search, the info of which should then be (hopefully) translated to Form C.

    The data in question is the same set of IDs that need to be inserted into Form C so that the Form can autofill the rest of the information. The data selection in this case is take from a combo box, from both Form A and B.

    I'd be very thankful for any help, and please excuse my limited knowledge about Access.

    Sunday, December 13, 2020 9:32 AM

All replies

  • Personally I would just have one form with different controls visible depending on user choices. Or possibly a form and subform arrangement. If necessary you can also modify the form/subform's record source according to chioices made.

    However if you want to continue with threes separate forms, you need to use global variables (or tempvars) to save the values of the items you want to reuse in the third form. Then in the third form, set the values of various controls equal to those global variables /tempvars.

    Sunday, December 13, 2020 3:14 PM
  • The data in question is the same set of IDs that need to be inserted into Form C so that the Form can autofill the rest of the information. The data selection in this case is take from a combo box, from both Form A and B.

    Hi NikS7,

    I do not know exactly what kind of data must be inserted in Form C.

    My favourite way to do these kind of things, is to pass this information to form C in the OpenArgs argument when opening Form C. A button on Form A and/or on Form B gathers this information and opens Form C.

    In the Open event of Form C you can analyze the data in the form's OpenArgs property, construct the RecordSource of Form C, and take further actions, if necessary, to tune the form.

    Probably there are also other ways, but I use this way.

    If you need information from both forms, then you can you can define a variable for the other form in the Click event of the button to open Form C.

    The current form you can address with 'Me', the other form e.g. with 'other_form', after the definition:    Set other_form = Forms(other_form_name)

    Imb.

    Sunday, December 13, 2020 3:41 PM