Hi all,
Apologies in advance if the question is silly, must admit I'm not a professional IT person.
I have a pretty primitive database with one main form. The main table that feeds this form has a few required fields. Normally when user fills out the form and all that fields are filled out he runs a report based on current record.
In VBA code for the report button there is a chapter in the beginning about record's saving. All works while it's only one user on the line....
The problems starts when there are a few of them, and the first one got stuck in the middle of filling out the required fields (went for coffee/ got distracted/ forgot to shut down etc.). In this scenario the next user gets 2501 error - the save operation cancel....
If I switch off saving then the report can be run with no required fields filled out at all, that is highly undesirable.
What should I do except for checking all the required fields for null in VBA before running the report?
The code is the following....
Private Sub Open_report_Click()
DoCmd.Save
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
DoCmd.OpenReport "rep_xxx", acViewPreview, , "[number]=" & Me.Number
End Sub
Will appreciate any advice :)
Apologies in advance if the question is silly, must admit I'm not a professional IT person.
I have a pretty primitive database with one main form. The main table that feeds this form has a few required fields. Normally when user fills out the form and all that fields are filled out he runs a report based on current record.
In VBA code for the report button there is a chapter in the beginning about record's saving. All works while it's only one user on the line....
The problems starts when there are a few of them, and the first one got stuck in the middle of filling out the required fields (went for coffee/ got distracted/ forgot to shut down etc.). In this scenario the next user gets 2501 error - the save operation cancel....
If I switch off saving then the report can be run with no required fields filled out at all, that is highly undesirable.
What should I do except for checking all the required fields for null in VBA before running the report?
The code is the following....
Private Sub Open_report_Click()
DoCmd.Save
On Error Resume Next
DoCmd.RunCommand acCmdSaveRecord
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
DoCmd.OpenReport "rep_xxx", acViewPreview, , "[number]=" & Me.Number
End Sub
Will appreciate any advice :)
Save Record in Shared database
0 commentaires:
Enregistrer un commentaire