Kelly Napier
Registered User.
- Local time
- Today, 03:02
- Joined
- Sep 3, 2014
- Messages
- 13
HI
Some time ago I asked for advice on here and wasn't able to test it as I wasn't able to work on the database. I am self taught so don't understand a lot of the lingo I'm afraid. I was given the advice but I have no idea where to implement the 'solution'.
I have designed a client management database, each client has a Client Reference and this links them to everything in the database. When registering a client they complete the following forms Personal Info/Housing History/Offending History/Alcohol/Drugs/Physical Health/Mental Health. I have been able to design reports for Personal Info/Housing History/Offending History - but I'm now working on Mental Health and the issue I'm having is that there are four fields in this form which all have the same drop down list. So a client can register up to four diagnosed conditions. The fields are Diagnosis/Diagnosis2/Diagnosis3/Diagnosis4. What I want to do is calculate how many clients have Anxiety for example, and I want to count how many times Anxiety has been listed in each field and for that to be totalled.
So I got the following answer but I don't know where to put it, how to set it up or anything really:
Option Compare Database
Option Explicit
Dim TotalAnxiety As Integer
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
TotalAnxiety = TotalAnxiety + _
(([Diagnosis] & "" = "anxiety") + ([Diagnosis2] & "" = "anxiety") + _
([Diagnosis3] & "" = "anxiety") + ([Diagnosis4] & "" = "anxiety")) * -1
End Sub
Private Sub Report_Load()
TotalAnxiety = 0
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.yourUnboundTextbox = TotalAnxiety
End Sub
Please can you help me?
Some time ago I asked for advice on here and wasn't able to test it as I wasn't able to work on the database. I am self taught so don't understand a lot of the lingo I'm afraid. I was given the advice but I have no idea where to implement the 'solution'.
I have designed a client management database, each client has a Client Reference and this links them to everything in the database. When registering a client they complete the following forms Personal Info/Housing History/Offending History/Alcohol/Drugs/Physical Health/Mental Health. I have been able to design reports for Personal Info/Housing History/Offending History - but I'm now working on Mental Health and the issue I'm having is that there are four fields in this form which all have the same drop down list. So a client can register up to four diagnosed conditions. The fields are Diagnosis/Diagnosis2/Diagnosis3/Diagnosis4. What I want to do is calculate how many clients have Anxiety for example, and I want to count how many times Anxiety has been listed in each field and for that to be totalled.
So I got the following answer but I don't know where to put it, how to set it up or anything really:
Option Compare Database
Option Explicit
Dim TotalAnxiety As Integer
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
TotalAnxiety = TotalAnxiety + _
(([Diagnosis] & "" = "anxiety") + ([Diagnosis2] & "" = "anxiety") + _
([Diagnosis3] & "" = "anxiety") + ([Diagnosis4] & "" = "anxiety")) * -1
End Sub
Private Sub Report_Load()
TotalAnxiety = 0
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
Me.yourUnboundTextbox = TotalAnxiety
End Sub
Please can you help me?