I'm not exactly sure how to start this post. My question is pretty simple, but it will take a little bit of context before I can state it. (And thanks in advance for taking the time to read this!)
Context:
What I'm essentially trying to do is create a poor man's document imaging system in Access 2007. I have a database that contains forms and modules (but no data) that I'm going to distribute to 200+ users in my company that have limited Access knowledge.
The database will allow users to do the following:
Once the template form is copied, textboxes are automatically added to the new form for each field in the newly copied table. The new form is then displayed as a subform on the 'main' form. The 'main' form contains various controls that facilitate searching the subform for a desired record.
Once the user is finished (and as the user's database closes) the copied table and subform are deleted.
What I've found is that Access is pretty good about creating and deleting tables via code. However, Access is NOT good about creating and deleting forms via code. In testing, after only a couple of uses, the line of code that copies the template form bombs out. It throughs a "2501 - The CopyObject action was canceled" error.
It appears that after creating and deleting the subform a couple times, even though the old subform no longer appears in the Naviagor Window, remnants of the form still exist somewhere in the database. When the code tries to copy the template form into a new subform, Access finds the remains of the old subform and cancels the copy action.
The offending line of code is:
Question:
Can anyone think of a better way to go about this than creating and destorying subforms?
Bonus Question:
If not, is there a way to create datasheet style subforms without using templates?
I hope all this makes sense. Thanks for any suggestions you may have.
sphinney
Context:
What I'm essentially trying to do is create a poor man's document imaging system in Access 2007. I have a database that contains forms and modules (but no data) that I'm going to distribute to 200+ users in my company that have limited Access knowledge.
The database will allow users to do the following:
- View a list of 20 or so different Access databases/tables (each with a unique set of field names and types) that are maintained by various deparments in my company
- Select a desired table
- Search the selected table for a desired record
- Lauch the appropriate application to view the document referenced by the selected record
Once the template form is copied, textboxes are automatically added to the new form for each field in the newly copied table. The new form is then displayed as a subform on the 'main' form. The 'main' form contains various controls that facilitate searching the subform for a desired record.
Once the user is finished (and as the user's database closes) the copied table and subform are deleted.
What I've found is that Access is pretty good about creating and deleting tables via code. However, Access is NOT good about creating and deleting forms via code. In testing, after only a couple of uses, the line of code that copies the template form bombs out. It throughs a "2501 - The CopyObject action was canceled" error.
It appears that after creating and deleting the subform a couple times, even though the old subform no longer appears in the Naviagor Window, remnants of the form still exist somewhere in the database. When the code tries to copy the template form into a new subform, Access finds the remains of the old subform and cancels the copy action.
The offending line of code is:
Code:
DoCmd.CopyObject , TemplateForm_Name, acForm, SubForm_Name
Can anyone think of a better way to go about this than creating and destorying subforms?
Bonus Question:
If not, is there a way to create datasheet style subforms without using templates?
I hope all this makes sense. Thanks for any suggestions you may have.
sphinney
Comment