|
-
Oct 2nd, 2012, 09:13 AM
#1
Thread Starter
New Member
[RESOLVED] calculated fields on each row in a report
I have VB 6.5, so hopefully this is the correct forum. If not please tell me which one is better to join.
I have a report with some VB code that executes on load. Basically it assigns values to two text boxes that act as "sums" (week1 and week2) on hours worked during the week dependent upon numbers/codes in each day box. So I have two weeks worth of hours and codes (14 boxes) and calculations for week1 and week2 populate the wk1 and wk2 textboxes. These 16 box rows repeat from the detail section on load.
The problem is the formula is only working on the last row. So the two sums (not straight sums but calculated formulae off the 14 numbers and codes) from the last row, repeat themselves for all the other rows as well. How can I do this a better way?
-
Oct 2nd, 2012, 11:07 AM
#2
Re: calculated fields on each row in a report
Welcome to the forums 
You have the right forum site, just the wrong forum section.
VB 6.5 is actual VBA (Visual Basic for Applications) and is associated with a Microsoft Office product. Based on your question I'm guessing you are using Excel which is why I've moved your question from the VB.NET section to the Office Development section.
-
Oct 2nd, 2012, 12:08 PM
#3
Thread Starter
New Member
Re: calculated fields on each row in a report
Its actually Access, sorry I neglected to put that. Is Office Dev still the right section?
-
Oct 5th, 2012, 12:45 PM
#4
Thread Starter
New Member
Re: calculated fields on each row in a report
Well its been a few days on my first thread here, with no replies. Was hoping for more activity! I ended up putting the VB code into functions, and having the textboxes call them. Thanks anyway!
-
Oct 5th, 2012, 01:32 PM
#5
Re: calculated fields on each row in a report
Is it doing what you need? I was going to ask you to clarify your requirement a little, but never got around to it!
-
Oct 5th, 2012, 02:24 PM
#6
Thread Starter
New Member
Re: calculated fields on each row in a report
Yes! Thank you! Basically I had a report that looked (for sake of argument) basically like this:
WEEK 1 M T W TH F SA SU WEEK 2 M T W TH F SA SU
39 8 8 8 8 7 0 0 40 8 8 8 8 8 0 0
39.5 8 8 8 7.5 8 0 0 45.5 8 8 8 8 8 0 5.5
32 8 *y* 8 8 8 *po* 0 16 8 0 *s* 0 8 0 0
40 8 8 8 8 8 0 0 34 8 8 8 8 2 0 0
32 24 32 31.5 31 0 0 32 24 24 24 26 0 5.5
(Hope this formats right when I send it), where Weeks 1, Week 2 and the bottom row sums are all calculated when the form loads. The bottom row was very easy, but I couldnt figure out how to calculate sideways for days for the week columns, mainly because the daily hrs values also had codes in them which needed additional VB code to reference their intended hourly value. So I ended up putting all this code into public functions, and then called the names of these functions from the textbox properties. Works perfect!
-
Oct 6th, 2012, 04:17 AM
#7
Re: calculated fields on each row in a report
can't get better than that
thnx for posting solution, great if anyone finds when searching
pls mark thread resolved
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 9th, 2012, 07:28 AM
#8
Thread Starter
New Member
Re: calculated fields on each row in a report
Im sorry I dont see anywhere to mark this as resolved
-
Oct 9th, 2012, 08:25 AM
#9
Re: calculated fields on each row in a report
Should be under "Thread Tools" in the upper right corner
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|