Record Look Up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AccessHelp32
    New Member
    • Dec 2006
    • 20

    Record Look Up

    Hi All,

    I have forms A, B, C and D all linked through various ID fields - A linked to B, B linked to C, C linked to D. I also have a command button on each form that closes the current form and opens the next.

    How can I set up the forms so that when form B closes and form C opens, form C opens displaying the same ID record I was working with in from B?
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    In a similar case I used the tab control.
    The forms can be placed as subforms and the tabs can be controlled like:
    me.tabCTL.pages ("first").visib le = false
    me.tabCTL.pages ("second").visi ble = true
    etc. with the pagename or relative like:
    me.tabCTL.pages (1).visible = false
    me.tabCTL.pages (2).visible = true
    etc.

    Idea ?

    Nic;o)

    Comment

    • AccessHelp32
      New Member
      • Dec 2006
      • 20

      #3
      Originally posted by nico5038
      In a similar case I used the tab control.
      The forms can be placed as subforms and the tabs can be controlled like:
      me.tabCTL.pages ("first").visib le = false
      me.tabCTL.pages ("second").visi ble = true
      etc. with the pagename or relative like:
      me.tabCTL.pages (1).visible = false
      me.tabCTL.pages (2).visible = true
      etc.

      Idea ?

      Nic;o)
      Forgive me in advance if I complicate this. It's a good idea, but because I didn't disclose more details, it may not work. My apologies.

      Forms are set up so that Form A also has Subform A1 attached (linked through an ID field). Subfrom A1 then becomes Main Form B on the next form. Main Form B has Subform B1 attached (linked through ID field). Subform B1 then becomes Main Form C on the next form. And so on.

      As I move from "Main Form B/Subform B1" to Main Form C, How can I load Main Form C with the last record I used in Subform B1?

      Otherwise, Main Form C load with the first record on file and I have to scroll to find the newest record I added. I hope this makes sense, and again my apologies.

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        No problem, the tabbed control approach will also work for this scenario.
        All you need is to place (hidden) textcontrols for every needed linking key.
        Let's assume subformB has the OrderID to be linked to subformC.
        Place a field txtOrderID on the mainform.
        Add to subformB's OnCurrent event:
        Parent.txtOrder ID = Me.OrderID
        Finally add txtOrderID as the Master Linkage field for the subformC and OrderID as the Child linkage field.
        The subformB and subformC are now automatically synchronized.

        Getting the idea ?

        Nic;o)

        Comment

        • AccessHelp32
          New Member
          • Dec 2006
          • 20

          #5
          Originally posted by nico5038
          No problem, the tabbed control approach will also work for this scenario.
          All you need is to place (hidden) textcontrols for every needed linking key.
          Let's assume subformB has the OrderID to be linked to subformC.
          Place a field txtOrderID on the mainform.
          Add to subformB's OnCurrent event:
          Parent.txtOrder ID = Me.OrderID
          Finally add txtOrderID as the Master Linkage field for the subformC and OrderID as the Child linkage field.
          The subformB and subformC are now automatically synchronized.


          Getting the idea ?

          Nic;o)
          I think so. But just to be clear, Subform B has the OrderID to link to Main Form C - not sure if this makes a difference. Also, not sure what you mean by "SubformB's OnCurrent event." I can't find the OnCurrent event.

          I test this out most of tonight post a reply tomorrow.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            Originally posted by AccessHelp32
            I think so. But just to be clear, Subform B has the OrderID to link to Main Form C - not sure if this makes a difference. Also, not sure what you mean by "SubformB's OnCurrent event." I can't find the OnCurrent event.

            I test this out most of tonight post a reply tomorrow.
            In Design mode open Properties (Alt-Enter) then select the subform (Properties will show a Subform/Subreport item).
            Now select the form that is in the subform (Properties should show as a Form now.) and look down the properties list. Under Tag you should see the On Current property. Set this to [Event Procedure] then click on the ... button at the right to create / switch to a new 'OnCurrent' event procedure.

            Comment

            Working...