D
Deleted member 147267
Guest
@MatthewM - one thing that could be considered when shortening your code is whether or not you could decide that the field order of your form's recordsource would never change if it is a table (or that you could base your code on a query instead of the form and the query field order would never change) which would allow you to eliminate form field references altogether. Either way, the best consolidation of your code can be had by employing a loop (I think only one) and using Excel's Offset property. Static fields would allow you to write rs.Fields(i) where i is an integer from 1 to the field count. If not, you would have to refer to the fields by name, which would incur more code (as I see it).
I think it is possible to get your entire code down to around 50 lines, assuming it goes consecutively row by row. I didn't study the whole thing. Also as I'm stating there is the field order thing to deal with, plus I wonder why you're inserting a row each time rather than just moving down one. Formatting reasons?
EDIT - forgot to mention that you would do well to eliminate special characters (save for underscore, which I do not use) and spaces in all db object names. In fact, whoever names your directory folders should do the same.
Items Being Worked on (Matt)
is an abysmal name for a folder. People who did that sort of thing drove me nuts. Same goes for spreadsheet tab names. Sorry if that's you - just trying to impart how bad it is. Keep learning Access vba and you'll eventually understand.
I think it is possible to get your entire code down to around 50 lines, assuming it goes consecutively row by row. I didn't study the whole thing. Also as I'm stating there is the field order thing to deal with, plus I wonder why you're inserting a row each time rather than just moving down one. Formatting reasons?
EDIT - forgot to mention that you would do well to eliminate special characters (save for underscore, which I do not use) and spaces in all db object names. In fact, whoever names your directory folders should do the same.
Items Being Worked on (Matt)
is an abysmal name for a folder. People who did that sort of thing drove me nuts. Same goes for spreadsheet tab names. Sorry if that's you - just trying to impart how bad it is. Keep learning Access vba and you'll eventually understand.
Last edited by a moderator: