You should post your query with a question like this, but i think i know what your problem is.
Since you're not using the primary key column and therefore inserting into only a subset of the fields, you need to list the fields you will be using like this:
INSERT INTO SomeTable (col1,col2,col3) VALUES ('val1','val2',3)
You were probably trying to do something like this:
INSERT INTO SomeTable VALUES ('val1','val2',3)
Which will not work because your primary key field is auto numbered.
Try this:
sqlQuery =
"INSERT INTO Youth (" +
"NumbersOfSport, " +
"YouthID, " +
"Price, " +
"TotalCostOfTraining, " +
"PercentageDiscount, " +
"AmountDue," +
"DatePurchased" +
") VALUES (" +
toSql(qtyInt) + ", " +
toSql(youthInt) + ", " +
toSql(priceStr) + ", " +
toSql(totalCstStr) + ", " +
toSql(discountStr) + ", " +
toSql(amtDueStr) + ", " +
toSql(Convert.ToDateTime(purDate)) + ")"
You were missing a comma here: "AmountDue" +
should be: "AmountDue," +
VB format:
sqlQuery = "INSERT INTO Youth (" + "NumbersOfSport, " + "YouthID, " + "Price, " + "TotalCostOfTraining, " + "PercentageDiscount, " + "AmountDue" + "DatePurchased" + ") VALUES (" + toSql(qtyInt) + ", " + toSql(youthInt) + ", " + toSql(priceStr) + ", " + toSql(totalCstStr) + ", " + toSql(discountStr) + ", " + toSql(amtDueStr) + ", " + toSql(Convert.ToDateTime(purDate)) + ")"