multi-user db, can't save vba created form

  • Thread starter Thread starter jovobas
  • Start date Start date
J

jovobas

I created a multi-user db, with users Admin and student in an mdw-
file.
When a student logs on, he gets a switchboard with a few buttons, one
for creating a form.
This button has an onclick-event calling a vba-sub: makemyform, making
a form from scratch, with module attached.
At the end of the sub I try to save the new form with this code:

temp = frm.Name
newName = "frm_" & uniquename 'the sub calls a function for
creating a unique name
'Saving the form
With DoCmd
1 .Save acForm, temp
2 .Close acForm, temp, acSaveYes
3 .DeleteObject acForm, newName
4 .Rename newName, acForm, temp
5 .Close acModule, mdl.Name, acSaveYes
End With

When the student hits this code, there is a 2501 error at line 1, "the
save action was cancelled".
Now the strange part
if a student runs this as Admin, he gets the same error.
if I run this either as Admin or student, I don't get the error.

Any and all insights welcome.
tnx
 
In a shared database, multiple users may update data but only a single user
may update objects. You need to have a source control product installed
such as SourceSafe to allow multiple users to update objects in a shared
database.

Creating forms on the fly is an inefficient method. You can control data
access by using parameter queries. To make your current process work, each
user requires his own copy of the database. That means you will need to
split the database (which is good practice anyway) into a back end with just
tables and a front end with all other objects. The FE links to the tables
in the BE so all users update the same set of data but since each has his
own copy of the FE, he is the only user and therefore will be allowed to
save objects.
 
Thank you for the reply.
I separated the DB into FE and BE.
I stil have two questions:
1. The form I'm trying to create is a form in which the end-user has
to fill in values into a pivot-table. Because I learned some time ago
that you can't create a fill-in form based on a pivot-table, I'm
taking the web-based approach and writing the form from scratch. Or is
there a better way ?
(I think a form with subform won't work because the records don't
exist yet in the table)
This brings me to the second problem.
2. Because the user has to be able to create a new form. What's
preventing him from creating his own form in which he tries to delete
tables etc.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top