Hey all,

I wondering if you could help me get my head around this problem.

connetionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = KellihersLawnmowers.accdb"
                cnn = New OleDbConnection(connetionString)
                cnn.Open()
               overDue = "SELECT tblCustomer.*, tblMachineHistory.*, tblPayments.* FROM (tblCustomer INNER JOIN tblMachineHistory ON tblCustomer.Customer_ID = tblMachineHistory.Customer_ID) INNER JOIN tblPayments ON tblMachineHistory.Machine_ID = tblPayments.Machine_ID WHERE (((tblMachineHistory.Machine_ID)=16) AND ((tblCustomer.Customer_ID)=10) AND ((tblPayments.Payment_ID)=40));"

                 cmd = New OleDbCommand(overDue, cnn)
                reader = cmd.ExecuteReader()


                ' txtAddressNot.Text = reader.Item(19) & vbCr & vbLf & reader.Item(20) & vbCr & vbLf & reader.Item(21) & vbCr & vbLf & reader.Item(22)

                If IsDBNull(reader.Item(5)) = True Then
                    txtOverBill.Text = "No Email address Provided"
                    btnSendOverDue.Enabled = False

I am using this statement to select value for a Access database. However it keeps returning catching the follow error. I have pasted the exact same query into Access and it returns the correct record.

Does anyone have an Ideas

Thanks
James


No data exists for the row/column.

You need to invoke Read() method.

...
IF reader.Read() Then
      If IsDBNull(reader.Item(5)) = True Then
           txtOverBill.Text = "No Email address Provided"
           btnSendOverDue.Enabled = False
      End If
End IF
....
commented: Thanks for the Help. Clear Post too +1

Thanks that solved the problem.

Cheers
James

You need to invoke Read() method.

...
IF reader.Read() Then
      If IsDBNull(reader.Item(5)) = True Then
           txtOverBill.Text = "No Email address Provided"
           btnSendOverDue.Enabled = False
      End If
End IF
....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.