Object reference not set to an instance of an object
Dim addCustsForm As CustAddForm ' a form that is part of the project
Dim providerStr As System.String
Dim dataSourceString As System.String
providerStr = "Provider='Microsoft.JET.OLEDB.4.0';"
dataSourceString = New String("Data Source='C:\Documents and Settings\jfitzpatrick\My Documents\Tester.mdb'")
CustDDCon.Open()
conCustCon.Open(providerStr & dataSourceString)
rcsCust.CursorType = ADODB.CursorTypeEnum.adOpenDynamic
rcsCust.Open("Customers", conCustCon)
addCustsForm.setupRecords(providerStr, dataSourceString)
The error occurs when I pass the variables to this sub routine, which is in a different form. When I "comment" out the addCustForms line, the programme runs without any hitches.
The sub routine is declared as follows:
Public Sub setupRecords(ByVal providerString As System.String, ByVal sourceString As System.String)
& the form is declared as Public Class CustAddForm
:confused:

