none
MS Access subform not displaying records and not navigating RRS feed

  • Question

  • One-to-one relationship. One table is the main form, the other the subform. The main form's table has more records than the subform table. Master and child links are set. I have decompiled and have done compact and repair. I suspect my application is malfunctioning. In that case it is not the first time (I fixed it). Nothing seems to be working this time. I have also imported into a new database.

    On form-load both forms and fields are well. I continue to the next records using a ['NEXT'] button and reach the end of the sub-forms records therefore having blanks fields. I try to navigate to the previous records (also using a button) but the subform does not move/navigate. Nothing happens to the subform.

    It seems like it has gotten worse because first it was navigating but was not obeying code saying when text box is filled disable checkbox and vise versa.

    Monday, May 15, 2017 9:59 AM

All replies

  • Hello,

    Does the issue persist? 

    I suggest you try to compact and repair the database. If the issue persist, could you reproduce it in another database or other computer?

    I suggest you share detail steps here to reproduce the issue.

    If the issue has been resolved,  we would appreciate if you could share your solution here.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 26, 2017 3:18 AM
    Moderator
  • I am not able to share a screenshot if it is required. I have done compact and repair and decompile.

    Here is the Current event code:

    Private Sub Form_Current()

        btnPreviousRecord.Enabled = Not (CurrentRecord = 1 Or NewRecord)
        btnNextRecord.Enabled = Not (CurrentRecord = DCount("*", RecordSource) Or NewRecord)

        'For a new Order table record
        If (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value) Or _
            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value = "") Then
                Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
        Else
            Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = True
    ''    ElseIf (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value) Or _
    ''        Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value = "") Then
    '            'Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = False
    '            'Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Enabled = True
    '            Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
    '    ElseIf (Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False) Then
    '            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = True
    '    ElseIf (Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = True) Then
    '            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = False
    ''    Else
    ''        Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = True
    ''        Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Enabled = False
    ''        Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
        End If

    End Sub

        
    Thursday, July 6, 2017 10:02 AM
  • The uncommented IF statement is causing this. When I bring in the one I commented out, the program functions. The question now is of course why?
    Thursday, July 6, 2017 11:26 AM
  • The uncommented IF and the one you have commented out are functionally quite different.  The one you have commented out takes into account the value of chkboxOrder_Cancelled; the other does not.  See if this gives the results you are expecting:
    Private Sub Form_Current()
    
         btnPreviousRecord.Enabled = Not (CurrentRecord = 1 Or NewRecord)
         btnNextRecord.Enabled = Not (CurrentRecord = DCount("*", RecordSource) Or NewRecord)
    
         'For a new Order table record
         If NZ(Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Value, "") = "" OR Forms!Order.OrderSubform.Form.NewRecord = true 
                 Forms!Order.OrderSubform.Form.chckbxOrder_Cancelled.Value = False
    	     Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Enabled = True
                 Forms!Order.OrderSubform.Form.chckbxOrder_Cancelled.Enabled = False
         Else
                 Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Enabled = Not Forms!Order.OrderSubform.Form!chckbxOrder_Cancelled.Value
         End if
    
    
    
     End Sub


    Miriam Bizup Access MVP

    Thursday, July 6, 2017 12:38 PM
  • Hi Rylan

    This issue disappeared before and now it is back on the same form/subform. It has not occurred with any other. What I did now was import that form/subform with its tables and relationships into a new Access file with the code, ran it and the problem persists.

    I don't like to think my database needs that tool. Do you still suggest it as a solution?

    Again here is the code for Current event:

    Private Sub Form_Current()

        btnPreviousRecord.Enabled = Not (CurrentRecord = 1 Or NewRecord)
        btnNextRecord.Enabled = Not (CurrentRecord = DCount("*", RecordSource) Or NewRecord)

        'For a new Order table record
        If (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value) Or _
            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value = "") Then
                Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
        Else
            Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = True

        End If
        
    '    If (IsNull(Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value) Or _
    '        Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Value = "") Then
    '            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = False
    '            Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Enabled = True
    '            Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
    '    Else
    '        Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = True
    '    If (Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False) Then
    '            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = True
    '    ElseIf (Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = True) Then
    '            Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = False
    '    Else
    '        Forms!Order!OrderSubform.Form!txtDate_Of_Order_Cancel.Enabled = True
    '        Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Enabled = False
    '        Forms!Order!OrderSubform.Form!chckbxOrder_Cancelled.Value = False
       ' End If
        
    '      If Nz(Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Value, "") = "" Then ' Or _
    '        (Forms!Order.OrderSubform.Form.NewRecord = True) Then
    '        Forms!Order.OrderSubform.Form.chckbxOrder_Cancelled.Value = False
    '        Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Enabled = True
    '        Forms!Order.OrderSubform.Form.chckbxOrder_Cancelled.Enabled = False
    '     Else
    '        Forms!Order.OrderSubform.Form.txtDate_Of_Order_Cancel.Enabled = Not
    '        Forms!Order.OrderSubform.Form!chckbxOrder_Cancelled.Value = True
    '     End If
        
    End Sub


    Friday, July 7, 2017 7:45 AM