By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

Creating a report based on field values

P: 3
I've developed a test that results in standard scores from 35 to 99. Now, i need to be able, when a score for a specific scale is, let's say, >=75 and <=84, to have a predefined block of text be placed in a report. And, if the score for that same scale is >=85 and <=94, to have another text box be placed there instead, in the same place in the report. I am no programming guru, but if i'm given a simple example, i think i'd be able to tweak it to what i need. i hope this is possible and that someone will please help me figure this out.

Let's say my table is called mytbl and the field is called delsum, which has the value of 78. i want to be able to have a block of text placed into a report that says something like "When individuals score in such a range, thus and such can be expected, blah blah blah."

PLEASE TELL ME THIS IS POSSIBLE
Mar 9 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,638
I've developed a test that results in standard scores from 35 to 99. Now, i need to be able, when a score for a specific scale is, let's say, >=75 and <=84, to have a predefined block of text be placed in a report. And, if the score for that same scale is >=85 and <=94, to have another text box be placed there instead, in the same place in the report. I am no programming guru, but if i'm given a simple example, i think i'd be able to tweak it to what i need. i hope this is possible and that someone will please help me figure this out.

Let's say my table is called mytbl and the field is called delsum, which has the value of 78. i want to be able to have a block of text placed into a report that says something like "When individuals score in such a range, thus and such can be expected, blah blah blah."

PLEASE TELL ME THIS IS POSSIBLE
There are several methods which you can use to accomplish this, but this is the 1st one that comes to mind. First, a couple of assumptions:
  1. Your Report Name is Report1.
  2. You have a Table named mytbl which contains a Field (INTEGER) named [delsum].
  3. The Record Source for Report1 is mytbl.
  4. Your Report, among other Fields, contains the [delsum] Field and is named the same, namely, delsum.
Time for the fun part!
  1. Create an Unbound Text Box on Report1 and name it txtResults.
  2. Copy and Paste the following Variable Declaration to the General Declarations Section of Report1. The Variable 'must' be Declared as Variant to allow for the possibility of Null Values for [delsum], unless the Required Property of this Field is set to True.
    Expand|Select|Wrap|Line Numbers
    1. Private varTestResults As Variant
  3. Copy and Paste similar code to the Format Event in the Detail Section of Report1:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    2. varTestResults = Me![delsum]
    3.  
    4. If IsNull(varTestResults) Then
    5.   Me![txtResults] = "No Grade Listed"
    6. ElseIf varTestResults >= 96 Then
    7.   Me![txtResults] = "WOW!"
    8. ElseIf varTestResults >= 85 And varTestResults <= 95 Then
    9.   Me![txtResults] = "Great!"
    10. ElseIf varTestResults >= 75 And varTestResults <= 84 Then
    11.   Me![txtResults] = "Good!"
    12. ElseIf varTestResults <= 74 Then
    13.   Me![txtResults] = "EL STINKO!"
    14. End If
    15. End Sub
  4. The code has been tested and is fully functional, let me know how you make out.
Mar 10 '08 #2

P: 3
There are several methods which you can use to accomplish this, but this is the 1st one that comes to mind. First, a couple of assumptions:
  1. Your Report Name is Report1.
  2. You have a Table named mytbl which contains a Field (INTEGER) named [delsum].
  3. The Record Source for Report1 is mytbl.
  4. Your Report, among other Fields, contains the [delsum] Field and is named the same, namely, delsum.
Time for the fun part!
  1. Create an Unbound Text Box on Report1 and name it txtResults.
  2. Copy and Paste the following Variable Declaration to the General Declarations Section of Report1. The Variable 'must' be Declared as Variant to allow for the possibility of Null Values for [delsum], unless the Required Property of this Field is set to True.
    Expand|Select|Wrap|Line Numbers
    1. Private varTestResults As Variant
  3. Copy and Paste similar code to the Format Event in the Detail Section of Report1:
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    2. varTestResults = Me![delsum]
    3.  
    4. If IsNull(varTestResults) Then
    5.   Me![txtResults] = "No Grade Listed"
    6. ElseIf varTestResults >= 96 Then
    7.   Me![txtResults] = "WOW!"
    8. ElseIf varTestResults >= 85 And varTestResults <= 95 Then
    9.   Me![txtResults] = "Great!"
    10. ElseIf varTestResults >= 75 And varTestResults <= 84 Then
    11.   Me![txtResults] = "Good!"
    12. ElseIf varTestResults <= 74 Then
    13.   Me![txtResults] = "EL STINKO!"
    14. End If
    15. End Sub
  4. The code has been tested and is fully functional, let me know how you make out.
My Friend!
You are a genius!!!!
It works perfectly. I couldn't be more pleased.
Thank you so much for your expert help.
Mar 10 '08 #3

ADezii
Expert 5K+
P: 8,638
My Friend!
You are a genius!!!!
It works perfectly. I couldn't be more pleased.
Thank you so much for your expert help.
You are quite welcome, Freud52.
Mar 11 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.