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

print pass instead of P access report

100+
P: 232
hi
I am using XP operating system and access 2007
Ours is a table which contains a field result with data A, P and F. I want to print report based on it.
I want to print pass instead of P and fail instead of F and so on. I made the report based on it. I know that it can be achieved through VBA .I selected the result field in report design mode on view code I write the code but I am really unable to achieve the target it still print A,P and so on in layout view.
Expand|Select|Wrap|Line Numbers
  1. Private Sub RESULT_BeforeUpdate(Cancel As Integer)
  2. If (RESULT.Value = "A") Then
  3. RESULT.Value = "ABSENT"
  4. RESULT.Text = "ABSENT"
  5. End If
  6. End Sub
I am very new to this subject kindly help
Thanks in advance
Apr 27 '12 #1

✓ answered by Mihail

Or, in the report:
Design a new text box and set it's control source as:
Expand|Select|Wrap|Line Numbers
  1. =IIF([FiledName]="P","Pass",IIF([FiledName]="F","Fail","Absent"))
Hide the old one (I am not sure but, maybe, you can remove it)

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,494
This would need to be done in an After_Update() event procedure. Before_Update() will not allow you to change the control's value.
Expand|Select|Wrap|Line Numbers
  1. Private Sub RESULT_AfterUpdate()
  2.     with Me
  3.         Select Case .RESULT
  4.         Case "A"
  5.             .RESULT = "Absent"
  6.         Case "F"
  7.             .RESULT = "Fail"
  8.         Case "P"
  9.             .RESULT = "Pass"
  10.     End With
  11. End Sub
Apr 27 '12 #2

100+
P: 759
Or, in the report:
Design a new text box and set it's control source as:
Expand|Select|Wrap|Line Numbers
  1. =IIF([FiledName]="P","Pass",IIF([FiledName]="F","Fail","Absent"))
Hide the old one (I am not sure but, maybe, you can remove it)
Apr 28 '12 #3

NeoPa
Expert Mod 15k+
P: 31,494
Agreed. I was misled by the existing code which appears to be 100% inappropriate within the confines of this question.
Apr 28 '12 #4

Post your reply

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