Hi

I am writing a program that will take in a CSV file and then write it to a database (MS Access). So far, i can create a table, add fields to the table and insert one record. Im inserting the pieces of data one at a time using a loop, because i wont know how many fields will be in the CSV file and I have found that using the INSERT command inserts the data and then skips a line, so you end up with a table with diagonal data. So now i'm using the INSERT to place the first bit of data in the table (the Primary Key) and then trying to use the UPDATE command to fill in the rest of the fields. The syntax I am using for the UPDATE is

SQL = "UPDATE tblTest SET FirstName= 'John' WHERE LastName = 'Smith'"

If anyone can see where I am going wrong it would be greatly appreciated. I have tried just about everything, but there is probably something simple i'm overlooking.

Thanks
Kevin

The update syntax looks good. If you could post the schema of your database and the error message you are getting when you try to update, it would be easier to debug.

Thanks for your help, but I managed to solve the problem. I created the query in access and then copied its SQL code into my project.

Thanks anyway,
Kevin

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.