Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    Houston, Texas, USA
    Posts
    242
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Sync two forms (Access 97)

    I have two forms that are linked by lot number. The second form is a popup and shows lab data. When I open the form the first time and click on the button to open the popup, all goes well. However, I cannot go to another record and have the popup show the related data unless I press shift f9 or click on the first button again. I want to be able to switch to another lot number on the first form and have the popup automatically show the data for that lot number. I have tried a variety of techniques and nothing seems to work. Field name in first form is lot#, in the second is LOT_NUMBER.

    Is there a way to do this?

    Thanks for any help.

    itconc

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Sync two forms (Access 97)

    In the oncurrent event of the first form, put in code to requery the other form.

    Forms!otherformname.requery
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    Houston, Texas, USA
    Posts
    242
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Sync two forms (Access 97)

    Thanks, I have tried that previously. It does not work. I get either the data from the previous record on the first form or nothing.

    itconc

  4. #4
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sync two forms (Access 97)

    how does the pop up know which record to show the first time? Do you use docmd.openform "formname",,,(and use a where clause here) or is the query of the pop up based on the criteria of the first form, or do you send a filterstring and filteron to the form as you open it? Depending on this, that is how you would requery the popup.
    If it is the first, you would have to test if the pop up is open and if it is resend the correct where clause or change the filter. If it is the second or third....

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sync two forms (Access 97)

    Create a query based on the lab data table with the fields you need for the second form. Set the criteria for the Lot_Number field to

    [Forms]![FirstForm]![Lot#]

    where FirstForm is the name of the first form. Use this query as record source for the second form. John's code should work then.

    If this doesn't help, please provide detailed information about a) the code used to open the second form and [img]/forums/images/smilies/cool.gif[/img] the record source of the second form. If possible, post a stripped down copy of your database. See <post#=401925>post 401925</post#> for instructions.

  6. #6
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    Houston, Texas, USA
    Posts
    242
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Sync two forms (Access 97)

    Thank you Hans. You have saved my live again!
    I stripped all the varies code snippets out of both forms, set the recordsource correctly for both forms and John's code worked like a charm.
    Thanks to both of you.

    itconc

Posting Permissions

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