D
Dale Fye
I'm working on a function that will copy a specific record. Anyone have a
function that will do this? Basically, I'd like to be able to pass a
tablename, the ID field, and ID value to this function, have it copy the
appropriate record, and return the new value. In addition, I would like to
have the option of passing a newID (FK) value so that if the ID field is
actually a FK, I could replace that value with the optional NewID argument.
My current concept, is to open a recordset with the current record. then
Clone that recordset, add a new record to the clone, and loop through the
fields, setting the field in the copy to the value of the original set. The
problem I'm having at the moment is trying to determine whether the current
field is an autonumber field, in which case, I would get the value rather
than putting it. I guess I could probably try setting the value, and if it
generates an error, get the value, but I was thinking there might be a more
elegant way to determine whether a field is an autonumber.
Would appreciate any ideas or code samples.
--
Dale
email address is invalid
Please reply to newsgroup only.
function that will do this? Basically, I'd like to be able to pass a
tablename, the ID field, and ID value to this function, have it copy the
appropriate record, and return the new value. In addition, I would like to
have the option of passing a newID (FK) value so that if the ID field is
actually a FK, I could replace that value with the optional NewID argument.
My current concept, is to open a recordset with the current record. then
Clone that recordset, add a new record to the clone, and loop through the
fields, setting the field in the copy to the value of the original set. The
problem I'm having at the moment is trying to determine whether the current
field is an autonumber field, in which case, I would get the value rather
than putting it. I guess I could probably try setting the value, and if it
generates an error, get the value, but I was thinking there might be a more
elegant way to determine whether a field is an autonumber.
Would appreciate any ideas or code samples.
--
Dale
email address is invalid
Please reply to newsgroup only.