Tags: access, automatically, avalue, control, database, fill, form, forms, microsoft, mysql, oracle, preceeding, sql, values

How do I automatically fill in values from another form?

On Database » Microsoft Access

3,662 words with 2 Comments; publish: Fri, 06 Jun 2008 12:12:00 GMT; (25060.55, « »)

Hey there,

Could really use some help on how to automatically fill in a control with a

value from a preceeding form. I'm using several forms to enter various

properties/data for water wells. I just want to be able to enter the "well

name" in the first form, then use a button (e.g. "Next") to close the form

and open the next corresponding form with the well name automatically

displayed. I only need the "well name" to be saved in the first table.

So far, I can perform this task using a macro in "AfterUpdate" of the first

form. However, when I close the form using the "Next" button, I just get an

error message.

If my problem makes any sense, could someone please give some clues for what

to try?

Many (advanced) thanks!

All Comments

Leave a comment...

  • 2 Comments
    • You could use the OpenArgs to pass the value to the new form, or you could

      use the button to set the current form as visible = False, open the new form

      and popluate any required fields on the new form using the

      Me.txtExample1.Value = Forms!<non-visibleformname>!txtFieldtocopy.Value idea,

      then close the old form once used.

      "Geogeek" wrote:

      > Hey there,

      > Could really use some help on how to automatically fill in a control with a

      > value from a preceeding form. I'm using several forms to enter various

      > properties/data for water wells. I just want to be able to enter the "well

      > name" in the first form, then use a button (e.g. "Next") to close the form

      > and open the next corresponding form with the well name automatically

      > displayed. I only need the "well name" to be saved in the first table.

      > So far, I can perform this task using a macro in "AfterUpdate" of the first

      > form. However, when I close the form using the "Next" button, I just get an

      > error message.

      > If my problem makes any sense, could someone please give some clues for what

      > to try?

      > Many (advanced) thanks!

      >

      #1; Fri, 06 Jun 2008 12:13:00 GMT
    • hfnet,

      Thank you for your response. Unfortunately, I wasn't able to figure out how

      to use your methods. They appear to be an approach using VisualBasic, which

      I haven't a clue how to use properly. However, the fact that I got a

      response to my problem inspired me to keep trying (since there was obviously

      some way to make it work).

      This probably isn't the most efficient way of doing this, but I finally got

      it to work by doing the following:

      First, I added a text box to the second form (leaving the default name as

      "Text2" for the text box). Then I created a macro using "SetValue" with the

      "Item" defined as: [Forms]![A2_Location]![Text2], and the "Expression"

      defined as: [Well_Name].

      Next, I set the "AfterUpdate" in the primary form to the macro. Also, the

      "Next" button in this form remained the same, which uses a macro to open the

      second form and close the active form.

      Now, when I close the primary form, the second form (i.e. A2_Location) opens

      with the well name displayed at the top of the form. I used the same concept

      for the remaining 7 forms.

      Thanks again for your response. Geogeek

      "hfnet" wrote:

      [vbcol=seagreen]

      > You could use the OpenArgs to pass the value to the new form, or you could

      > use the button to set the current form as visible = False, open the new form

      > and popluate any required fields on the new form using the

      > Me.txtExample1.Value = Forms!<non-visibleformname>!txtFieldtocopy.Value idea,

      > then close the old form once used.

      > "Geogeek" wrote:

      #2; Fri, 06 Jun 2008 12:14:00 GMT