Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2002
    Posts
    14

    Unanswered: Passing values between forms

    I have 2 forms and wish to use data entered on the first form to retrieve
    or populate a record on the second form.

    Any ideas are welcome.

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Forms("frmFirstForm").txtLastName referes to a textbox txtLastName on the frmFirstForm.


    Igor

  3. #3
    Join Date
    Jun 2002
    Posts
    14

    Forms

    Thanks for your reply.

    So if first form is "Contacts" and second form is "Admin" and they
    both have a field called RefNo I can use:

    Forms("Contacts").refno

    as a control source on Admin's RefNo ?

  4. #4
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    I wouldn't do that. I'd rather use AfterUpdate event of textbox txtRefno on frmAdmin to pass new value to txtRefno on frmContacts.

    Like here:

    Forms("frmContacts").txtRefno = me.txtRefno


    Igor

  5. #5
    Join Date
    Jun 2002
    Posts
    14

    Passing values between forms

    Not quite what I meant.

    I only need to update the receiving form with values from the original form.

    i.e.
    Form1 : Ref No, Surname, Forename

    Form2: same fields but do not want to enter twice. Just display.

  6. #6
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    You can use an unbound text box on your Admin form. Just place this code in the On Open event procedure of the Admin form.

    Me.txtRefNo = Forms![Contacts]![txtRefNo]

    This assumes that the text box on the Admin form is names txtRefNo


    David

  7. #7
    Join Date
    Jun 2002
    Posts
    14
    Thanks for your reply.

    Ok. So how do I get to the "On Open" procedure?

  8. #8
    Join Date
    Aug 2002
    Location
    Northampton, England
    Posts
    266
    OK. Open the form in design view. In the top left hand corner of the form you will see a little black square. Double click on the black square. You should now have a list of the forms properties. Scroll down until you come to On Open. Click in the field next to the On Open. This should bring up a down arrow and a box with 3 stops. Click on this and you will get a box to choose a builder. Choose Code builder. And there you have it. Just put the line of code in between Private Sub etc. etc and End Sub and that should do it.


    David

  9. #9
    Join Date
    Jun 2002
    Posts
    14

    Forms

    Thanks for your help.

  10. #10
    Join Date
    Jun 2002
    Posts
    14

    Keeping values passed to form from previous form

    Thanks to the replies to my first question.

    A very dim follow-up question is how to store those values in the table associated with the receiving form?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •