V
Viken Karaguesian
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.
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.