Hello
I searched for an answer to this question but didn’t find any here.
I’m using Access 2010.
Basically, I’ve got a table with reports, and reports have a revision number.
I found an answer about how to copy fields and update only one of them, but it looks somewhat like this:
INSERT INTO reports (fieldA, fieldB, fieldC, revision, fieldD, fieldE)
SELECT fieldA, fieldB, fieldC, 2, fieldD, fieldE
FROM reports
WHERE <somecondition to select which report to copy>
Thing is I have a load of fields, so I’d like something that would look more like this:
INSERT INTO reports
SELECT *, revision=2
FROM reports
WHERE <somecondition to select which report to copy>
I know that code is incorrect; it’s just to describe what I would like. As in, a way to not have a huge SQL line listing all the fields, but only the one I want to change.
(I want to keep a copy of previous revisions in the same table)
Thanks in advance to whoever can help 🙂
I found an interesting alternative in this question, using a temporary table
SQL clone record with a unique index
I can do the same, dropping the primary key and updating the revision, then copying it back to my table.
Not the solution I’m looking for, but an alternative way in the meantime.
EDIT:
Tried this solution without success:
VBA tells me something along the lines of “fields with multiple values are not allowed with SELECT INTO instructions (runtime error 3838)”
I have both an OLE field and an attachment field, which I suspect to be the cause of the error. But I need to keep them… :/