subform data disappears when entering data into main form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cheweedog
    New Member
    • Jan 2010
    • 10

    #1

    subform data disappears when entering data into main form

    I have a form that contains 1 subform. Everything works fine until I tab into a textbox in the bottom of the main form. The data in the subform disappears on the form, but the table is updated. How to get the data visible in the subform until I exit the form. I have the record selector, naviagtion button and dividing lines set to "No", and the scroll bar to neither. I have the master and child link set to po#'s on the form/subform.
  • mseo
    New Member
    • Oct 2009
    • 183

    #2
    hi
    as I understood from your question you have to link the subform to the mainform for example if you have:
    1- tableorders and its PK is orderID (its controls in the mainform)
    2- tableordersdeta ils FK is order_ID (its controls in the subform)
    you must link the subform to mainform using orderID
    and you can do that from the subform properties window - data tab
    link child field order_ID ( replace order_ID with name of the F.K of the tableorderdetai ls )
    link master field orderID of the primary key of tableorders

    Hope this helps

    Comment

    • cheweedog
      New Member
      • Jan 2010
      • 10

      #3
      Originally posted by mseo
      hi
      as I understood from your question you have to link the subform to the mainform for example if you have:
      1- tableorders and its PK is orderID (its controls in the mainform)
      2- tableordersdeta ils FK is order_ID (its controls in the subform)
      you must link the subform to mainform using orderID
      and you can do that from the subform properties window - data tab
      link child field order_ID ( replace order_ID with name of the F.K of the tableorderdetai ls )
      link master field orderID of the primary key of tableorders

      Hope this helps
      I have linked both main form and subform with the po# as reference. Everything is working fine, because the data does store in the proper tables. The only issue is that when I tab out of subform back to mainform, the data entered into the subform disappears from the screen view, but not the table. I am looking to see why this is happening. I have tried different setting in the field properties, but nothing fixes this issue. Any other idea will be helpful.

      Comment

      • mseo
        New Member
        • Oct 2009
        • 183

        #4
        hi,
        ok cheweedog
        you can set your mainform footer as invisible and creating command button and name it Details whereas you click this command button the subform will be visible and the code behind this command button is about preventing the subform from being visible if the required controls in the mainform is null
        and this is the code:
        Code:
        Private Sub Detail_Click()
        If IsNull(Me.[B]name of first control[/B]  Or Me.[B]second control [/B]Then
            MsgBox "The Fields of  ( your controls are required to add an order and its details", vbCritical
        Else
                Me.FormFooter.Visible = False
                    Me.FormFooter.Visible = True
                    DoCmd.MoveSize Height:=8000
            End If
        End Sub
        Hope this helps
        Last edited by mseo; Apr 26 '10, 05:57 PM. Reason: Edit code line

        Comment

        Working...