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

Why does this code not work?

100+
P: 158
I have a report where two controls should be dependent of the [moveINOUT] control on the same report.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Current()
  2.     If MoveINOUT = "IN" Then
  3.     NoteOUT.Visible = False
  4.     RepairOUT.Visible = False
  5.  
  6.     Else
  7.  
  8.     If MoveINOUT = "OUT" Then
  9.     NoteOUT.Visible = True
  10.     RepairOUT.Visible = True
  11.  
  12.     End If
  13.     End If
  14.  
  15. End Sub
I've tried a variation of ways and I don't get it, this code above should work???
any ideas? thanks
Feb 24 '10 #1
Share this Question
Share on Google+
6 Replies


mshmyob
Expert 100+
P: 903
Why do you have a nested if statement.

If your only two posiible values for MoveINOUT are "IN" or "OUT" then you just need the following:

Expand|Select|Wrap|Line Numbers
  1.  
  2. If MoveINOUT = "IN" Then 
  3.     NoteOUT.Visible = False 
  4.     RepairOUT.Visible = False 
  5.  Else 
  6.     NoteOUT.Visible = True 
  7.     RepairOUT.Visible = True 
  8. End If 
  9.  
Keep in mind you did not mention what was "NOT WORKING".

cheers,
Feb 24 '10 #2

TheSmileyCoder
Expert Mod 100+
P: 2,321
A report has no "Current Event" (unless it was added in 2007 which I wouldn't know).

Use Detail_Format or Detail_Print.
Feb 24 '10 #3

100+
P: 158
Yes it is Access 2007 and yup, it does have an "On current"
Feb 24 '10 #4

TheSmileyCoder
Expert Mod 100+
P: 2,321
Well try using detail_Format and see if that doesnt do it for you :)
Feb 24 '10 #5

100+
P: 158
That doesn't work No.
Feb 24 '10 #6

mshmyob
Expert 100+
P: 903
You still have not told us what is happening (ie: what is the error)

Is any part of the if statement triggering?

Where are the variables and how is the INOUT variable populated?

Have you changed the code like I suggested?

Important: What view are you opening the report in??? To get the Report.Current event to trigger the report must be run in Print Preview or Normal mode.

etc.

cheers,
Feb 25 '10 #7

Post your reply

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