Adding record to Access
Posted on 2003-03-16
I'm fairly new to VB and I'm having big problems adding a record to my Access DB. I have using the following code: -
'Adds new record to DB
AdodcHire.Recordset.Fields("Customer_Number") = txtCustNumber.Text
AdodcHire.Recordset.Fields("Fleet_Number") = txtCarFleetNumber.Text
AdodcHire.Recordset.Fields("Date_Out") = txtDateOut.Text
AdodcHire.Recordset.Fields("Date_Return") = dtpDateDue
AdodcHire.Recordset.Fields("Mileage_Out") = txtMileageOut.Text
When I run the program I get the following error message "Empty rows cannot be inserted. Rows must have at least one column value set".
I can't understand it, as the values I am passing i.e. txtCustNumber.Text, does exsist. When I debug the error it is stating txtCustNumber is NULL. How can this be?