ive attached my programme herewith.

the report doesn't function properly

in the tab 2 i have put a command button which generates the report

could you please help

Attachments

The code after the Exit Sub cannot be reached at all. the procedure exits at that point and the code which u have written below the Error Handler Label is never reached. That's why the error.

Private Sub Form_Load()

    On Error GoTo Form_Load_Error

    Set con = New ADODB.Connection
    con.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & App.Path & "\Office Utilization.mdb"
    Call FillLocation
    Call Filllocation2
    
Form_Load_Done:
    Exit Sub

Form_Load_Error:
    MsgBox "An Error has occured in Procedure Form_Load." & vbCrLf & vbCrLf & Err.Number & " : " & Err.Description
    Resume Form_Load_Done



  Dim i As Integer
  
  ' Get a recordset to use with the report
  Set rs = CreateRecords
  
  ' Populate Comboboxes
  For i = 0 To cboSort.Count - 1
    With cboSort(i)
      .AddItem "(None)"
      .AddItem "locname"
      .AddItem "floorname"
      .AddItem "seatno"
      .AddItem "empname"
      .ListIndex = 0
    End With
  Next

End Sub

Please correct this procedure. It should be like this.

Private Sub Form_Load()

    On Error GoTo Form_Load_Error

    Set con = New ADODB.Connection
    con.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & App.Path & "\Office Utilization.mdb"
    Call FillLocation
    Call Filllocation2
    
    Dim i As Integer
  
    ' Get a recordset to use with the report
    Set rs = CreateRecords

    ' Populate Comboboxes
    For i = 0 To cboSort.Count - 1
        With cboSort(i)
            .AddItem "(None)"
            .AddItem "locname"
            .AddItem "floorname"
            .AddItem "seatno"
            .AddItem "empname"
            .ListIndex = 0
        End With
    Next

Form_Load_Done:
    Exit Sub

Form_Load_Error:
    MsgBox "An Error has occured in Procedure Form_Load." & vbCrLf & vbCrLf & Err.Number & " : " & Err.Description
    Resume Form_Load_Done

End Sub

Hope this solves ur problem

Regards
Shaik Akthar

This question has already been answered. Start a new discussion instead.