but I keep getting an error when saving
That is of zero help to anyone who would try to help you. Always post the error number and message (don't expect everyone to lookup up the meaning of an error number for you). You need to learn how to troubleshoot as advised. Also can use debug.print lines to see your variables (e.g. value of sql statements you assign to a variable) in the immediate window:
Code:
start of code here
strSQL = "Insert Into" & tbl & " (" & col & ") Values (""" _ ...etc.
Debug.Print strSQL
rest of code
I figure that is where at least one problem lies due to lack of delimiting (using quotes around string portions or octothorpes around date portions as required) or a missing space. It may not be the issue you're having right now, but then again, you provided no info about that.
Ditto on the code tags.
Last edited by Micron; 08-20-2023 at 01:12 PM.
Reason: added info
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.