MasterBase.MasterBaseQuery resides in a module and is used everytime I access the database.
Code:
Public Sub MasterBaseQuery(SetQuery As String)
RecordCount = 0
Exception = ""
Try
#Region "Open Connection/Load Table"
MasterBaseConnection.Open() 'Open connection
ListCommand = New OleDbCommand(SetQuery, MasterBaseConnection) 'Database Command
Params.ForEach(Sub(p) ListCommand.Parameters.Add(p)) 'Load params into command
Params.Clear() 'Clear params list
ListDataSet = New DataSet
ListTable = New DataTable
ListAdapter = New OleDbDataAdapter(ListCommand)
RecordCount = ListAdapter.Fill(ListTable)
ListDataSet.Tables.Add(ListTable) 'This Dataset is used for setting comboboxes
#End Region
Catch ex As Exception
Exception = ex.Message
MsgBox(ex.Message + vbLf + vbCrLf + MyError)
End Try
MyError = ""
If MasterBaseConnection.State = ConnectionState.Open Then MasterBaseConnection.Close()
End Sub
I sure hope this is not the problem as it is referenced over 100 times. Basically everywhere I need to access the database.