Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

"Save Record" button not working after adding "Edit" button.

Discussion in 'Information Technology' started by Viken Karaguesian, Jul 28, 2006.

  1. Viken Karaguesian

    Viken Karaguesian
    Expand Collapse
    Guest

    Hello all,

    First of all, thanks to everyone for their previous support :>) I have more
    advice to ask.

    In order to prevent accidental loss of data (from inadvertent keystrokes)
    I've locked the Main Form from editing using the form Properties. Instead,
    I've added a button to edit the form. You click the button, which
    temporarily unlocks the form, make your changes and click the same button
    when you're finished making changes. The code for this function was
    provided to me by someone (from this board, I think) about 2 years ago for
    another DB I was working on. I copied and pasted the code to the current DB
    I'm working on.

    Now, the "Edit" button works fine, but the "Save Record" button doesn't
    work. I keep on getting an error message saying that the save feature "...is
    not available at this time". I added the "Save Record" button using the
    auto-Wizard that appears when you create a new button.

    Here's some relevant code:

    1) The "Edit" button:

    Private Sub EditRecord_Click()
    If Me.EditRecord.Caption = "Edit Record" Then
    With Me
    .AllowAdditions = True
    .AllowEdits = True
    .AllowDeletions = True
    End With

    Me.EditRecord.Caption = "Ok"
    Else
    DoCmd.Save
    With Me
    .AllowAdditions = False
    .AllowEdits = False
    .AllowDeletions = False
    End With
    Me.EditRecord.Caption = "Edit Record"
    End If
    End Sub


    2) The "Save Record" button:

    Private Sub Bttn_Save_Record_Click()
    On Error GoTo Err_Bttn_Save_Record_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

    Exit_Bttn_Save_Record_Click:
    Exit Sub

    Err_Bttn_Save_Record_Click:
    MsgBox Err.Description
    Resume Exit_Bttn_Save_Record_Click

    End Sub


    Any input is greatly appreciated.

    --
    Viken K.
    http://www.vikenk.com
     
  2. Loading...

    Similar Threads Forum Date
    Convinced By Sikh, Muslim Family Saves Hindu Lives Interfaith Dialogues Jun 24, 2016
    S Asia Sikhs want Nawaz Sharif to help save Pakistan Gurdwaras Breaking News Jan 23, 2014
    Save Your Sanity for Less (Financial Fix Video) Business, Lifestyle & Leisure Jan 15, 2014
    Sikhi is in Ruins. How Can We Save It? Sikh Sikhi Sikhism Jan 4, 2013
    Save the Historical Gurdwaras in Pakistan Sikh Gurdwaras Dec 21, 2012

  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    Try this and see if it works for you:

    Private Sub EditRecord_Click()
    If Me.EditRecord.Caption = "Edit Record" Then
    With Me
    .AllowAdditions = True
    .AllowEdits = True
    .AllowDeletions = True
    .EditRecord.Caption = "Save"
    End With

    Else
    DoCmd.RunCommand acCmdSaveRecord
    With Me
    .AllowAdditions = False
    .AllowEdits = False
    .AllowDeletions = False
    .EditRecord.Caption = "Edit Record"
    End With
    End If
    End Sub
    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access

    "Viken Karaguesian" <vikenkNO_SPAM@NO_SPAMcomcast.net> wrote in message
    news:xYSdneGv4YfFU-HZnZ2dnUVZ_sGdnZ2d@comcast.com...
    > Hello all,
    >
    > First of all, thanks to everyone for their previous support :>) I have

    more
    > advice to ask.
    >
    > In order to prevent accidental loss of data (from inadvertent keystrokes)
    > I've locked the Main Form from editing using the form Properties. Instead,
    > I've added a button to edit the form. You click the button, which
    > temporarily unlocks the form, make your changes and click the same button
    > when you're finished making changes. The code for this function was
    > provided to me by someone (from this board, I think) about 2 years ago for
    > another DB I was working on. I copied and pasted the code to the current

    DB
    > I'm working on.
    >
    > Now, the "Edit" button works fine, but the "Save Record" button doesn't
    > work. I keep on getting an error message saying that the save feature

    "...is
    > not available at this time". I added the "Save Record" button using the
    > auto-Wizard that appears when you create a new button.
    >
    > Here's some relevant code:
    >
    > 1) The "Edit" button:
    >
    > Private Sub EditRecord_Click()
    > If Me.EditRecord.Caption = "Edit Record" Then
    > With Me
    > .AllowAdditions = True
    > .AllowEdits = True
    > .AllowDeletions = True
    > End With
    >
    > Me.EditRecord.Caption = "Ok"
    > Else
    > DoCmd.Save
    > With Me
    > .AllowAdditions = False
    > .AllowEdits = False
    > .AllowDeletions = False
    > End With
    > Me.EditRecord.Caption = "Edit Record"
    > End If
    > End Sub
    >
    >
    > 2) The "Save Record" button:
    >
    > Private Sub Bttn_Save_Record_Click()
    > On Error GoTo Err_Bttn_Save_Record_Click
    >
    >
    > DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    >
    > Exit_Bttn_Save_Record_Click:
    > Exit Sub
    >
    > Err_Bttn_Save_Record_Click:
    > MsgBox Err.Description
    > Resume Exit_Bttn_Save_Record_Click
    >
    > End Sub
    >
    >
    > Any input is greatly appreciated.
    >
    > --
    > Viken K.
    > http://www.vikenk.com
    >
    >
     
  4. Viken Karaguesian

    Viken Karaguesian
    Expand Collapse
    Guest

    Arvin,

    Worked like a charm. Thanks!

    --
    Viken K.
    http://www.vikenk.com


    "Arvin Meyer [MVP]" <a@m.com> wrote in message
    news:udrvn6EhGHA.5068@TK2MSFTNGP05.phx.gbl...
    > Try this and see if it works for you:
    >
    > Private Sub EditRecord_Click()
    > If Me.EditRecord.Caption = "Edit Record" Then
    > With Me
    > .AllowAdditions = True
    > .AllowEdits = True
    > .AllowDeletions = True
    > .EditRecord.Caption = "Save"
    > End With
    >
    > Else
    > DoCmd.RunCommand acCmdSaveRecord
    > With Me
    > .AllowAdditions = False
    > .AllowEdits = False
    > .AllowDeletions = False
    > .EditRecord.Caption = "Edit Record"
    > End With
    > End If
    > End Sub
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    >
    > "Viken Karaguesian" <vikenkNO_SPAM@NO_SPAMcomcast.net> wrote in message
    > news:xYSdneGv4YfFU-HZnZ2dnUVZ_sGdnZ2d@comcast.com...
    >> Hello all,
    >>
    >> First of all, thanks to everyone for their previous support :>) I have

    > more
    >> advice to ask.
    >>
    >> In order to prevent accidental loss of data (from inadvertent keystrokes)
    >> I've locked the Main Form from editing using the form Properties.
    >> Instead,
    >> I've added a button to edit the form. You click the button, which
    >> temporarily unlocks the form, make your changes and click the same button
    >> when you're finished making changes. The code for this function was
    >> provided to me by someone (from this board, I think) about 2 years ago
    >> for
    >> another DB I was working on. I copied and pasted the code to the current

    > DB
    >> I'm working on.
    >>
    >> Now, the "Edit" button works fine, but the "Save Record" button doesn't
    >> work. I keep on getting an error message saying that the save feature

    > "...is
    >> not available at this time". I added the "Save Record" button using the
    >> auto-Wizard that appears when you create a new button.
    >>
    >> Here's some relevant code:
    >>
    >> 1) The "Edit" button:
    >>
    >> Private Sub EditRecord_Click()
    >> If Me.EditRecord.Caption = "Edit Record" Then
    >> With Me
    >> .AllowAdditions = True
    >> .AllowEdits = True
    >> .AllowDeletions = True
    >> End With
    >>
    >> Me.EditRecord.Caption = "Ok"
    >> Else
    >> DoCmd.Save
    >> With Me
    >> .AllowAdditions = False
    >> .AllowEdits = False
    >> .AllowDeletions = False
    >> End With
    >> Me.EditRecord.Caption = "Edit Record"
    >> End If
    >> End Sub
    >>
    >>
    >> 2) The "Save Record" button:
    >>
    >> Private Sub Bttn_Save_Record_Click()
    >> On Error GoTo Err_Bttn_Save_Record_Click
    >>
    >>
    >> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
    >> acMenuVer70
    >>
    >> Exit_Bttn_Save_Record_Click:
    >> Exit Sub
    >>
    >> Err_Bttn_Save_Record_Click:
    >> MsgBox Err.Description
    >> Resume Exit_Bttn_Save_Record_Click
    >>
    >> End Sub
    >>
    >>
    >> Any input is greatly appreciated.
    >>
    >> --
    >> Viken K.
    >> http://www.vikenk.com
    >>
    >>

    >
    >
     

Share This Page