Attribute VB_Name = "Module1"
Global con As New ADODB.Connection
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub Main()
con.CursorLocation = adUseClient
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Viray.mdb;"
frmAdd.Show vbModal
End Sub

Public Sub Navigate(Index As Integer, Recordset As ADODB.Recordset)

    On Local Error Resume Next
        With Recordset
            Select Case Index
            Case 0
                If Not .RecordCount <= 1 Then
                End If
            Case 3
                If Not .RecordCount <= 1 Then
                End If
            Case 2
                If Not .AbsolutePosition >= .RecordCount Or .RecordCount <= 1 Then
                End If
            Case 1
                If Not .AbsolutePosition <= 1 Then
                End If
            End Select
        End With

End Sub

Public Sub Handler(Error As ErrObject)

    If Error.Number <> 0 Then
        MsgBox "Error Number: " & Error.Number & vbNewLine & Error.Description, vbExclamation, "Unexpected Error"
    End If

End Sub

Public Sub ShellEx(PathName As String)
'Sub used to open a non-excutable file
    If ShellExecute(&O0, "Open", PathName, vbNullString, vbNullString, 1) < 33 Then
        Handler Err
    End If

End Sub

Project Homepage: