I have a csv file of orders I want to import into my acct program. The problem I have is updating the invoice number field. I know the code to pull the last invoice number from my invoice table, but then I need to loop through my csv import table and update the invoice number field so the numbers are sequential. For instance, if the last invoice number in the invoice table is 7500 and there are 50 records in the import table, then I need to start at the next value 7501 in this case and assign that value to the invoice number field in the csv file incremented by 1. The number of records in the import table vary, so I assume I need some kind of loop. I'm using Access 2003. Thank you for any assistance.
Scott Axton
@Reply 4 years ago
If you don't feel comfortable with VBA bring your CSV into Excel and fill in the Order number using Fill Series. Save it and do your import to Access.
Easy if you know a bit of VBA.
DMax your Last Invoice number and place it into a
Variable and add 1.
Then use a For Next Loop to update each record either as you are importing it or in a temp table prior to importing it.
Honestly the best way in my mind would probably be to use a recordset but that is a bit more advanced and I don't know your knowledge level. Those are covered starting in Access Developer 16
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.