i've picked one form, called 'Registration' as a sort of test bed on which to develop the functionality which will hopefully be applied to the others. by way of laying the groundwork for the rest of this query, 'Registration' uses a Record Source of the same name. the variable 'Form_Flag'is a Y/N variable i've added to the underlying 'Registration' table.
i currently have a collection of forms with 'Print' buttons, each button launching a report that prints out the contents of the data entry screen for the patient record being viewed.
i think it'd be 1) good to remind the user as they scroll through records via a form which records have been printed and which have not, 2) that later i might provide the users with the ability to create a query as well -- its purpose being to filter out those records that had never been printed or possibly vice versa.
in terms of how i'd try to implement goal '1', what i'm trying to do is cause the 'Print' button to disappear when a record gets printed, disallow further editing of this form for this record and finally to display a previously invisible 'Enable Edits' button on the form (its purpose being to unlock the form for this patient's record and to visually remind a user that there exists a printed record of the form for this patient).
wrt when the 'Enable Edits' button is visible, the record would become editable again once 'Enable Edits' got clicked, at which time the 'Enable Edits' button would disappear and the 'Print' button would re-appear.
hopefully that covers the lot.
this is what i've come up with so far.
Private Sub Form_Current()
If Me!Form_Flag = True Then
Me.AllowEdits = False
Me.EnableEditsBtn.Visible = False
Else
Me.AllowEdits = True
Me.EnableEditsBtn.Visible = False
End If
End Sub
in addition to the code above, i've got the following for the OnClick of the 'Print' report button:
Private Sub Command238_Click()
On Error GoTo Err_Command238_Click
Dim stDocName As String
Me!Form_Flag = True
Me.Refresh
Me.AllowEdits = False
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = True
Me.Command238.Visible = False
stDocName = "Registration"
Me.Refresh
OpenReport_FX stDocName, acNormal, "", "[Patient Number] = " & Me![Patient Number]
Exit_Command238_Click:
Exit Sub
Err_Command238_Click:
MsgBox Err.description
Resume Exit_Command238_Click
End Sub
and the following for the OnClick event of the 'Enable Edits' button:
Private Sub EnableEditsBtn_Click()
Me.AllowEdits = True
Me.Command238.Visible = True
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = False
End Sub
there's more work that needs doing though....for example, when i click on the 'Print' button, i get a message to the effect "An expression you entered is the wrong data type for one of the arguments". the 'Print' button does not disappear and the 'Enable Edits' button does not wondrously appear either.
“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln
i currently have a collection of forms with 'Print' buttons, each button launching a report that prints out the contents of the data entry screen for the patient record being viewed.
i think it'd be 1) good to remind the user as they scroll through records via a form which records have been printed and which have not, 2) that later i might provide the users with the ability to create a query as well -- its purpose being to filter out those records that had never been printed or possibly vice versa.
in terms of how i'd try to implement goal '1', what i'm trying to do is cause the 'Print' button to disappear when a record gets printed, disallow further editing of this form for this record and finally to display a previously invisible 'Enable Edits' button on the form (its purpose being to unlock the form for this patient's record and to visually remind a user that there exists a printed record of the form for this patient).
wrt when the 'Enable Edits' button is visible, the record would become editable again once 'Enable Edits' got clicked, at which time the 'Enable Edits' button would disappear and the 'Print' button would re-appear.
hopefully that covers the lot.
this is what i've come up with so far.
Private Sub Form_Current()
If Me!Form_Flag = True Then
Me.AllowEdits = False
Me.EnableEditsBtn.Visible = False
Else
Me.AllowEdits = True
Me.EnableEditsBtn.Visible = False
End If
End Sub
in addition to the code above, i've got the following for the OnClick of the 'Print' report button:
Private Sub Command238_Click()
On Error GoTo Err_Command238_Click
Dim stDocName As String
Me!Form_Flag = True
Me.Refresh
Me.AllowEdits = False
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = True
Me.Command238.Visible = False
stDocName = "Registration"
Me.Refresh
OpenReport_FX stDocName, acNormal, "", "[Patient Number] = " & Me![Patient Number]
Exit_Command238_Click:
Exit Sub
Err_Command238_Click:
MsgBox Err.description
Resume Exit_Command238_Click
End Sub
and the following for the OnClick event of the 'Enable Edits' button:
Private Sub EnableEditsBtn_Click()
Me.AllowEdits = True
Me.Command238.Visible = True
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = False
End Sub
there's more work that needs doing though....for example, when i click on the 'Print' button, i get a message to the effect "An expression you entered is the wrong data type for one of the arguments". the 'Print' button does not disappear and the 'Enable Edits' button does not wondrously appear either.
“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln