D
Don Johnson
I have created a form in an Access 2007 database which on loading runs an
event procedure that modifies one of the fields in the query, and thereby, a
field in the table which is a source for the query. This table is a linked
table in an Access 97 database. The sole purpose of this form is to run the
Visual Basic code to modify this field.
Now, when I attempt to open this form, I frequently get the following message:
Run-time error ‘2046’:
The command or action ‘OpenForm’ isn’t available now.
My Visual Basic code contains the following line which is causing the problem:
DoCmd.GoToRecord acDataForm, “frmAssignPSHNoâ€, acNext
This form and code had been running without issue until I installed Office
2007 Service Pack 2 to solve some instability I was experiencing with some
Excel spreadsheets. Prior to installing Service Pack 2, I had never gotten
this message.
Now, I usually get this message although it will appear at various times.
The record source for this form is a query which usually contains 1 to 200
records. Sometimes, I will get the above message on the first record. Other
times, I will get the message on the ninth record. I have been unable to
discern a pattern as to what the situation is that is triggering the message.
For example, this morning the query contained 11 records. The first time I
ran the form I received the message in trying to move from the first to the
second record using Debug. I then stopped the execution, closed the form and
the database, reopened the database and tried to open the form and thereby
rerun the code. Again I got the message at the same place as it attempted to
move from the first to the second record. I again stopped the execution and
not only closed the database but also closed Access 2007. I then reopened
Access 2007 and opened the same database. This time when I opened the form,
the error did not occur until it was trying to move from the ninth to the
tenth record. There were no changes made to the database.
I thought that I could get around this problem by directly editing the query
records in the Visual Basic code. However, when it gets to the line
rec.Edit
where I have already defined “rec†previously with
Set rec = db.OpenRecordset(“qryMechMfrModUnâ€, dbOpenDynaset)
I get the error message
Run-time error ‘3027’:
Cannot update. Database or object is read-only.
I thought that the dbOpenDynaset would allow me to edit the record. If I
open the query “qryMechMfrModUn†I am able to manually update the desired
field.
Obviously I am missing something but I do not know what I am doing wrong.
Any suggestions?
event procedure that modifies one of the fields in the query, and thereby, a
field in the table which is a source for the query. This table is a linked
table in an Access 97 database. The sole purpose of this form is to run the
Visual Basic code to modify this field.
Now, when I attempt to open this form, I frequently get the following message:
Run-time error ‘2046’:
The command or action ‘OpenForm’ isn’t available now.
My Visual Basic code contains the following line which is causing the problem:
DoCmd.GoToRecord acDataForm, “frmAssignPSHNoâ€, acNext
This form and code had been running without issue until I installed Office
2007 Service Pack 2 to solve some instability I was experiencing with some
Excel spreadsheets. Prior to installing Service Pack 2, I had never gotten
this message.
Now, I usually get this message although it will appear at various times.
The record source for this form is a query which usually contains 1 to 200
records. Sometimes, I will get the above message on the first record. Other
times, I will get the message on the ninth record. I have been unable to
discern a pattern as to what the situation is that is triggering the message.
For example, this morning the query contained 11 records. The first time I
ran the form I received the message in trying to move from the first to the
second record using Debug. I then stopped the execution, closed the form and
the database, reopened the database and tried to open the form and thereby
rerun the code. Again I got the message at the same place as it attempted to
move from the first to the second record. I again stopped the execution and
not only closed the database but also closed Access 2007. I then reopened
Access 2007 and opened the same database. This time when I opened the form,
the error did not occur until it was trying to move from the ninth to the
tenth record. There were no changes made to the database.
I thought that I could get around this problem by directly editing the query
records in the Visual Basic code. However, when it gets to the line
rec.Edit
where I have already defined “rec†previously with
Set rec = db.OpenRecordset(“qryMechMfrModUnâ€, dbOpenDynaset)
I get the error message
Run-time error ‘3027’:
Cannot update. Database or object is read-only.
I thought that the dbOpenDynaset would allow me to edit the record. If I
open the query “qryMechMfrModUn†I am able to manually update the desired
field.
Obviously I am missing something but I do not know what I am doing wrong.
Any suggestions?