G
Guest
Hello everybody.
I am dealing with a strange error, that it seems not to be very hard to
correct, but I am really curious about the reason why it raises.
I have a bound form with a save button. When the user clicks that button,
the record gets saved by the following statement:
Application.RunCommand acCmdSaveRecord
My records are being saved fine. If the record is new, the Form_AfterInsert
event procedure is executed. This procedure has to perform some checks on the
form's data, and one of those checks consists of filling a bound object frame
control (called bofActa) with a MS Word document template, so that the user
does not need to retype stuff that is the same for all the records. I fill
the bound object frame control by executing the following statement:
Me.bofActa.Action = acOLECreateEmbed
I think my problems start here. By executing this statement, the record gets
dirty. The Form_AfterInsert ends execution painlessly, but the procedure
which has saved the record raises the runtime error 3021 ("No current
record"). Apparently, I cannot figure out what this error message means. All
I can say is that my record is saved well, despite the runtime error.
My guess is that the Application.RunCommand acCmdSaveRecord statement raises
that error if the record remains dirty after trying to save it. Any ideas
about this?
For my purposes, correcting this error was easy: when this error is raised,
all I have to do is to Resume the statement that raised it: that is to say, I
only have to reexecute the Application.RunCommand acCmdSaveRecord statement.
Thank you very much for your kind attention.
Reis Quarteu
I am dealing with a strange error, that it seems not to be very hard to
correct, but I am really curious about the reason why it raises.
I have a bound form with a save button. When the user clicks that button,
the record gets saved by the following statement:
Application.RunCommand acCmdSaveRecord
My records are being saved fine. If the record is new, the Form_AfterInsert
event procedure is executed. This procedure has to perform some checks on the
form's data, and one of those checks consists of filling a bound object frame
control (called bofActa) with a MS Word document template, so that the user
does not need to retype stuff that is the same for all the records. I fill
the bound object frame control by executing the following statement:
Me.bofActa.Action = acOLECreateEmbed
I think my problems start here. By executing this statement, the record gets
dirty. The Form_AfterInsert ends execution painlessly, but the procedure
which has saved the record raises the runtime error 3021 ("No current
record"). Apparently, I cannot figure out what this error message means. All
I can say is that my record is saved well, despite the runtime error.
My guess is that the Application.RunCommand acCmdSaveRecord statement raises
that error if the record remains dirty after trying to save it. Any ideas
about this?
For my purposes, correcting this error was easy: when this error is raised,
all I have to do is to Resume the statement that raised it: that is to say, I
only have to reexecute the Application.RunCommand acCmdSaveRecord statement.
Thank you very much for your kind attention.
Reis Quarteu