473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Simple Report Codes... for a newbee

All,
1. Do the following codes seem ok?
2. If so, then how do I pull the value of YOE1 and YOE2 into my
report? (to do some further calculations)

*************************************************
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As
Integer)

Dim YOE1 As Double
Dim YOE2 As Double

While Me.Discipline("RN")
YOE2 = 1
If Me.YearOfEmp < 2 Then YOE1 = 1
Else: If Me.YearOfEmp >= 2 And Me.YearOfEmp < 5 Then YOE1
= 1.03
Else: If Me.YearOfEmp >= 5 And Me.YearOfEmp < 10 Then YOE1
= 1.0609
Else: If Me.YearOfEmp >= 10 And Me.YearOfEmp < 15 Then
YOE1 = 1.09
Else: If Me.YearOfEmp >= 15 Then YOE1 = 1.12
End If
Wend

While Me.Discipline(Not "RN")
YOE1 = 1
If Me.YearOfEmp < 2 Then YOE2 = 1
Else: If Me.YearOfEmp >= 2 And Me.YearOfEmp < 5 Then YOE2
= 1.05
Else: If Me.YearOfEmp >= 5 And Me.YearOfEmp < 10 Then YOE2
= 1.1025
Else: If Me.YearOfEmp >= 10 Then YOE2 = 1.16
End If
Wend

End Sub

*************************************************8
Thanks,
Perry
Nov 12 '05 #1
4 1762
PerryC wrote:
All,
1. Do the following codes seem ok?
Yes and No. What are you doing with the While/Wend? It appears you are
calling a function called Discipline and passing the parameters of RN.
Not sure what the Not "RN" is. Maybe it should be
While Not Me.Discipline("RN")
instead.
2. If so, then how do I pull the value of YOE1 and YOE2 into my
report? (to do some further calculations)
I try to do this stuff in the query when possible. Again, I don't know
what you are while/wending. You could actually have a function you pass
in the query that returns back YOE1/2. Ex:

Yoe1 : GetVal1([YearOfEmp],[RNStatCode])
Yoe2 : GetVal1([YearOfEmp],[RNStatCode])

Public Function GetVal1(intYear As Integer, _
strRNCode As String) As DOuble

If strRNCode = "RN" Then
Select case intYear
Case 0 To 2
GetVal1 = 1
Case 0 To 2
GetVal1 = 1.03
Case 5 To 9
GetVal1 = 1.0609
Case 10 to 14
GetVal1 = 1.09
Case Else
GetVal1 = 1.12
End Select
Endif
End Function

Public Function GetVal2(intYear As Integer, _
strRNCode As String) As DOuble

If strRNCode <> "RN" Then
'put in correct GetVal2 values below
Select case intYear
Case 0 To 2
GetVal2 = 1.1
Case 0 To 2
GetVal2 = 1.2
Case 5 To 9
GetVal2 = 1.3
Case 10 to 14
GetVal2 = 1.4
Case Else
GetVal2 = 1.5
End Select
Endif
End Function

*************************************************
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As
Integer)

Dim YOE1 As Double
Dim YOE2 As Double

While Me.Discipline("RN")
YOE2 = 1
If Me.YearOfEmp < 2 Then YOE1 = 1
Else: If Me.YearOfEmp >= 2 And Me.YearOfEmp < 5 Then YOE1
= 1.03
Else: If Me.YearOfEmp >= 5 And Me.YearOfEmp < 10 Then YOE1
= 1.0609
Else: If Me.YearOfEmp >= 10 And Me.YearOfEmp < 15 Then
YOE1 = 1.09
Else: If Me.YearOfEmp >= 15 Then YOE1 = 1.12
End If
Wend
While Me.Discipline(Not "RN")
YOE1 = 1
If Me.YearOfEmp < 2 Then YOE2 = 1
Else: If Me.YearOfEmp >= 2 And Me.YearOfEmp < 5 Then YOE2
= 1.05
Else: If Me.YearOfEmp >= 5 And Me.YearOfEmp < 10 Then YOE2
= 1.1025
Else: If Me.YearOfEmp >= 10 Then YOE2 = 1.16
End If
Wend

End Sub

*************************************************8
Thanks,
Perry


Nov 12 '05 #2
Thanks for your help... Here are some additional questions... since I am
really a newbee in this.

1. Where should I place the Yoe1: GetVal1([YearOfEmp],[RNStatCode])? In
the query of the Report? Where is[RNStatCode] defined? Is the
report's public function? should it say strRNCode instead?

2. The Public Function GetVal1.... As Double, is placed in the Report?

3. Is strRNCode the same as Me.Discipline? How does them equate?

P.S.: See my other post today... May not be there for another couple
hours

Sincerely,
Perry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
Perry Cheng wrote:
Thanks for your help... Here are some additional questions... since I am
really a newbee in this.

1. Where should I place the Yoe1: GetVal1([YearOfEmp],[RNStatCode])? In
the query of the Report?
Open up the current recordsource of the report. (Report property sheet,
data tab). You can paste the above
Yoe1: GetVal1([YearOfEmp],[RNStatCode])
in the query builder...modifying of course the reference to rnstatcode.
Where is[RNStatCode] defined?

I made it up. I figured you had some sort of code that determinies if a
record is RN or not.

Is the report's public function? should it say strRNCode instead?
No, I'd put the code in a code module. Database window, Modules.

I don't know your table or query structures. I'm simply providing an
example.

2. The Public Function GetVal1.... As Double, is placed in the Report?
Read above response.

3. Is strRNCode the same as Me.Discipline? How does them equate?
I guess so...I thought Discipline was a function you wrote that didn't work.

P.S.: See my other post today... May not be there for another couple
hours

Sincerely,
Perry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #4
Thanks for your help. I was able to get it to work in a simplier way
without using codes in the OnOpen Event. Thanks again.

Perry

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: AstrA | last post by:
Hi All Wondered if you could help. Basically I have 2 tables that contain all the data I want for my report, but I need to put it in a particular way and I need to display it in an ASP page...
0
by: Becky | last post by:
Hi: I have a main report that calls a sub-report which contains several pages of data. One of the column headings in my sub-report is called "Funds". If several records contain the same Fund...
0
by: Becky | last post by:
Hi All: I know how to call up a Sub-Report in a Main Report by using VB codes. It goes something like this ... With acc .DoCmd.OpenReport "reportMain", acViewDesign, "", ""...
1
by: PerryC | last post by:
Can someone help me accomplish the following in a MSAccess Report: 1. Check if Me.Discipline = "RN" (within the source query) 2. Then check the Me.YearOfEmployment: (again within the same source...
2
by: Themis Parintas ste kardias | last post by:
i have on a report firstnames lastnames, codes, id and i wand to have these data on four columns but first column i wand to have labels like Fist name, last name, codes, ID Fist name Nick ...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
7
by: Li Pang | last post by:
Hi, I built a web form to display a crystal report in web, every thing work properly. I added then a button to display the report in the embedded adobe reader by using the below codes: Dim...
4
Fotorat
by: Fotorat | last post by:
Access 97 windows XP Pro I have done a crosstab query for a report with 12 months as the columns and job codes as rows counting people as the value: Link to view report so far Ps the zeros...
0
by: Tyler | last post by:
I have created various reports for my database. When I open the report in display mode all of the reports display on half of the screen without any buttons to close, maximize, print or do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.