Hi, all - here's the deal:
I have a subform in a main form that is a log. I would like a query that provides a value of the most recent entry to impact the main form. I have a query "qryRefStatus_Max" that basically provides the most recent entry of the log. The trick is pulling the value of that query for a particular patient so that certain fields are hidden and others appear depending on the status of that patient. Come patients have no records at all in the subform.
This is what I have done for code (and be gentle as I am not much of a coder):
Any assistance would be appreciated!
I have a subform in a main form that is a log. I would like a query that provides a value of the most recent entry to impact the main form. I have a query "qryRefStatus_Max" that basically provides the most recent entry of the log. The trick is pulling the value of that query for a particular patient so that certain fields are hidden and others appear depending on the status of that patient. Come patients have no records at all in the subform.
This is what I have done for code (and be gentle as I am not much of a coder):
Code:
If DCount("RefStatus", "qryRefStatus_Max", "[PtID]=" & Me.PtID) = 0 Then
Me.SuitLtrSubmit.Value = ""
Me.BypassLtrSubmit.Value = ""
Me.SuitLtrSubmit.Visible = False
Me.BypassLtrSubmit.Visible = False
Me.txtRefStatus.Value = ""
Exit Sub
End If
MaxRefStatus = DLookup("RefStatus", "qryRefStatus_Max", "[PtID]=" & Me.PtID)
If MaxRefStatus = "Denied" Then
Debug.Print "Its OK"
Forms![frmDatabaseMainNavigation]![navClinical Data]![SuitLtrSubmit].Visible = False
Forms![frmDatabaseMainNavigation]![navClinical Data]![BypassLtrSubmit].Visible = True
Else
Forms![frmDatabaseMainNavigation]![navClinical Data]![SuitLtrSubmit].Visible = True
Forms![frmDatabaseMainNavigation]![navClinical Data]![BypassLtrSubmit].Visible = False
End If
Any assistance would be appreciated!