subfrm1 textbox "On Click" opens subfrm2 with same record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brsawvel
    New Member
    • Oct 2007
    • 8

    subfrm1 textbox "On Click" opens subfrm2 with same record

    Hello,

    I have a form that has two subforms within it (frm1 - subfrm1, subfrm2)

    Does anyone know how I can create an "On Click" event for a textbox -fld1- that is within -subfrm1- (displays records in columnar view -frm2-) which would cause -subfrm2- (displays records in tabular view -frm3-) to display the same record as the value displayed in that textbox -fld1-?

    Thanks,

    brsawvel
  • brsawvel
    New Member
    • Oct 2007
    • 8

    #2
    xxxxxxxxxxxxxxx xxxxxx

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      Originally posted by brsawvel
      xxxxxxxxxxxxxxx xxxxxx
      What is this? A thread bump? Please don't bump threads unless you don't get a response after 24 hours. That is more for your sake than anything because I start answering threads from the oldest thread forward.

      If you're asking about accessing the properties across subforms, you have two options.

      You can use the absolute path:
      [Code=vb]
      Forms!FormName! SubformName.For m.ControlName.P roperty
      [/Code]
      or the relative path:
      [Code=vb]
      Me.Parent.Subfo rmName.Form.Con trolName.Proper ty
      [/Code]

      If you're asking about the algorithm then you'll need to let us know what you've tried.

      Comment

      • brsawvel
        New Member
        • Oct 2007
        • 8

        #4
        Sorry about that. Saw my previous post dropping back in pages quickly and thought it wasn't going to be responded to.

        I'm not sure what you meant by accessing the properties across the subforms, but what I have tried to do was to add this to the "On Click" Event of the textbox -

        DoCmd.OpenForm "frm1", acViewNormal,,"[YourCommonIDFie ldHere]=" & Me!YourFieldOnS ubFormHere

        But I receive an error stating the Open Form was stopped.

        I don't know if I wasn't clear enough (I'm extremely new at using Access, VB, and SQL), but I have two subforms within a form that retrieve data from the same table but display them differently (columnar and tabular). And the tabular displays more information than the columnar. I would like the textbox (which value is the pk) in the columnar subform to have an "On Click" event that tells the tabular subform to display the same record.

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          On Click may not work, I'm not sure. You may have to use On Current. But I see no reason On Click shouldn't work.

          Subforms are not "forms". They are not opened nor can you refer to them using their object name. Also, I'm not even sure you can tell the subform to go to a certain record from outside the subform. I'd have to do some testing to be sure.

          I think you may have to use the Filter property of the form. You'd have to access the property using one of the two paths I laid out earlier.

          Comment

          Working...