|
 |
access thread: save command
Message #1 by "Howard Stone" <ququmber@h...> on Wed, 12 Jun 2002 20:20:33
|
|
I want to use a cmdButton to save records on a form. The wizard gives a
complex one that has to do with backwards compatability:
DoCmd.DoMenuItem acForBar, acRecordMenu, acSaveRecord,, acMenuVersion
I tried replacing it with DoCmd.Save acForm, "frmName" but it does not
work.
What easy to remember line can I a write to the cmdbutton to save a record
thanks
Message #2 by "Gerald, Rand" <RGerald@u...> on Wed, 12 Jun 2002 14:45:17 -0500
|
|
Unfortunately, that kludged code is what works.
The other syntax:
DoCmd.Save acForm, "frmName"
is the code to SAVE THE FORM, not the record.
Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Wednesday, June 12, 2002 3:21 PM
To: Access
Subject: [access] save command
I want to use a cmdButton to save records on a form. The wizard gives
a
complex one that has to do with backwards compatability:
DoCmd.DoMenuItem acForBar, acRecordMenu, acSaveRecord,, acMenuVersion
I tried replacing it with DoCmd.Save acForm, "frmName" but it does not
work.
What easy to remember line can I a write to the cmdbutton to save a
record
thanks
Message #3 by mnjarzt@m... on Mon, 17 Jun 2002 16:09:28
|
|
> I want to use a cmdButton to save records on a form. The wizard gives a
c> omplex one that has to do with backwards compatability:
> DoCmd.DoMenuItem acForBar, acRecordMenu, acSaveRecord,, acMenuVersion
> I tried replacing it with DoCmd.Save acForm, "frmName" but it does not
w> ork.
> What easy to remember line can I a write to the cmdbutton to save a
record
> thanks
Message #4 by mnjarzt@m... on Mon, 17 Jun 2002 16:12:04
|
|
Docmd.RunCommand acCmdSelectAll
Docmd.Runcommand acCmdSaveRecord
'(first line may or may not be needed -try with or without)
Message #5 by Arthur Maloney <ArthurMaloney@s...> on Mon, 17 Jun 2002 16:22:29 +0100
|
|
Hello mnjarzt,
Monday, June 17, 2002, 5:09:28 PM, you wrote:
>> I want to use a cmdButton to save records on a form. The wizard gives a
c>> omplex one that has to do with backwards compatability:
>> DoCmd.DoMenuItem acForBar, acRecordMenu, acSaveRecord,, acMenuVersion
>> I tried replacing it with DoCmd.Save acForm, "frmName" but it does not
w>> ork.
>> What easy to remember line can I a write to the cmdbutton to save a
mmc> record
>> thanks
mmc> ---
mmc>
mmc>
This is what I use. As I use it. You do not need the error trap
Private Sub cmdSaveRecord_Click()
'* Purpose:
'* Save any pending changes.
'* History:
'* Created 09 May 2001 by Arthur Maloney.
On Error GoTo ErrorHandler
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
End If
ExitProcedure:
Exit Sub
ErrorHandler:
'* Purpose:
'* Display error message to user using library error handler.
'* History:
'* Created 14 May 2001 am;
m_Library.LibraryErrorHandler "frmEmployees--cmdSaveRecord_Click", Err.Number, Err.Description
GoTo ExitProcedure
End Sub
--
Best regards,
Arthur mailto:ArthurMaloney@s...
Message #6 by mnjarzt@m... on Tue, 18 Jun 2002 01:27:07
|
|
> Docmd.RunCommand acCmdSelectAll
> Docmd.Runcommand acCmdSaveRecord
'> (first line may or may not be needed -try with or without)
IMPORTANT:
in the above code replace the line:
Docmd.RunCommand acCmdSelectAll ' (selects all records)
with:
Docmd.RunCommand acCmdSelectRecord ' (selects current record)
sorry - bad mistake. (like I said this line may be totally uneccessary
anyway)
|
|
 |