Save and Close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following event procedure works fine when running as a single user. As
soon as two workstations are running the database, it returns an error, "Save
command cancelled"

Any suggestions are appreciated.


Private Sub Command35_Click()
On Error GoTo Err_Command35_Click

DoCmd.Save
DoCmd.Close


Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub
 
The following event procedure works fine when running as a single user. As
soon as two workstations are running the database, it returns an error, "Save
command cancelled"

The Save action saves *DESIGN CHANGES* to the structure of the form.
Is this what you intend? Or are you trying to save the data? If so,
it's not necessary - it's saved automatically when you close the form
or move off the current record. If you wish to save the record
programmatically, use either

DoCmd.RunCommand acCmdSaveRecord

or

If Me.Dirty Then
Me.Dirty = False
End If


You're getting the error because two users cannot make design changes
to a database simultaneously. If another user has the form open, you
cannot Save it.

You really should consider using a "split" database architecture: use
Tools... Database Utilities... Database Splitter Wizard to split the
database into a "backend" containing the tables and a "frontend"
containing all the forms, reports, queries etc. Each user gets a copy
of the frontend, all linked to the shared backend.

John W. Vinson[MVP]
 
I'm comfortable with setting up a split database so this should be fine. I'm
in a testing phase and wanted to do a review before splitting.

Good advice.
 

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