Hello,
I am having trouble with my database in Access. The problem lies in my report. I have created a report based off a query. The query contains all values that I'll need for my report- some will be directly on the report in text boxes, etc and others will be needed for calculations only and so are not directly on the report. My problem is when I'm writing the code for my text box "TriagePerc ent" which should, based on the AuditNum (pk) calculate the triage percent for each audit. The triage percent is basically checking to see if fields are true or false. If they're true, I'm adding one to my counter. At the end, I'm going to divide the counter by the number of items it counted (which will be hard-coded, never going to change) to get the Triage percent. Then I want that value to be shown in the text box on my report. Right now to simplify things, I'm just trying to get the counter value to display. I have spent hours trying to figure this out, I'm new to Access and VBA but have experience in coding in Java. I'm not sure if I put this under the correct Event, that's been something that's really difficult for me to determine.
Here's the shortened, tester version of VBA:
Nothing shows up at all, and when I try to compile the code, it says "method or data member not found".
Help, please? I feel like this should be very very simple coding but it's turning out to be difficult for me.
I am having trouble with my database in Access. The problem lies in my report. I have created a report based off a query. The query contains all values that I'll need for my report- some will be directly on the report in text boxes, etc and others will be needed for calculations only and so are not directly on the report. My problem is when I'm writing the code for my text box "TriagePerc ent" which should, based on the AuditNum (pk) calculate the triage percent for each audit. The triage percent is basically checking to see if fields are true or false. If they're true, I'm adding one to my counter. At the end, I'm going to divide the counter by the number of items it counted (which will be hard-coded, never going to change) to get the Triage percent. Then I want that value to be shown in the text box on my report. Right now to simplify things, I'm just trying to get the counter value to display. I have spent hours trying to figure this out, I'm new to Access and VBA but have experience in coding in Java. I'm not sure if I put this under the correct Event, that's been something that's really difficult for me to determine.
Here's the shortened, tester version of VBA:
Code:
Private Sub TriagePercent_BeforeUpdate(Cancel As Integer) Dim numYes As Integer numYes = 0 If Me.TriagNum.Value = True Then numYes = numYes + 1 End If If Me.PulmStatus.Value = True Then numYes = numYes + 1 End If Me.TriagePercentLabel.Caption = numYes End Sub
Help, please? I feel like this should be very very simple coding but it's turning out to be difficult for me.
Comment