sherlocked
Registered User.
- Local time
- Today, 03:25
- Joined
- Sep 22, 2014
- Messages
- 125
Hello experts,
I have a report that pulls data based on several SELECT statements into recordsets, counts the records in the sets and saves that count in INTEGER variables.
I am attempting to design an unbound control on my report that adds up the values of these variables to display a total count of records. I do this by dimming a variable to hold the total (I have tried this is INTEGER, DOUBLE and LONG) and then setting the value of the unbound text box on my report to this variable.
For some reason, the field is displaying extraneous zeroes when my report loads. The number should be "2" but it is displaying as "200". I have the unbound text box format set to General Number and the decimal place at 0.
I have stepped through my code and verified that the values of the variables I'm trying to add are actually there and not null or some other value that might screw up my math.
Any thoughts on what may be causing this? I've exhausted my (fairly limited) VBA knowledge trying to suss this out.
My code looks something like this:
Thanks in advance!
I have a report that pulls data based on several SELECT statements into recordsets, counts the records in the sets and saves that count in INTEGER variables.
I am attempting to design an unbound control on my report that adds up the values of these variables to display a total count of records. I do this by dimming a variable to hold the total (I have tried this is INTEGER, DOUBLE and LONG) and then setting the value of the unbound text box on my report to this variable.
For some reason, the field is displaying extraneous zeroes when my report loads. The number should be "2" but it is displaying as "200". I have the unbound text box format set to General Number and the decimal place at 0.
I have stepped through my code and verified that the values of the variables I'm trying to add are actually there and not null or some other value that might screw up my math.
Any thoughts on what may be causing this? I've exhausted my (fairly limited) VBA knowledge trying to suss this out.
My code looks something like this:
Code:
Dim Variable1 as Integer, Variable2 as Integer, Variable3 as Integer
Dim rs1 as dao.recordset, rs2 as dao.recordset, rs3 as dao.recordset
Dim Mytotal as Integer
Set rs1 = CurrentDb.OpenRecordset("SELECT STATEMENT")
Set rs2 = CurrentDb.OpenRecordset("SELECT STATEMENT")
Set rs3 = CurrentDb.OpenRecordset("SELECT STATEMENT")
Variable1 = rs1.recordcount
Variable2 = rs2.recordcount
Variable3 = rs3.recordcount
Mytotal = Variable1 + Variable2 + Variable3
Thanks in advance!