Looping Coding Issue

Thank you for your patience with me on this. I'm confused as Time1 is a combo box as well. There are Time2 through Time23 in the report. I need a code that repeats what happens with Time1 and Other1 in Time2 - Time23 and Other 2 - Other23.
 
I just realized what you were talking about....I'm such an idiot!
 
:banghead: So if it isn't one thing it is another. I realized I need an If Then statement since some of the Time boxes may be null, however when I put in the following code and try to run it I get Run-time error '13': Type mismatch. The bolded line is highlighted. Any idea what I'm doing wrong with the code?

Private Sub Detail1_Print(Cancel As Integer, PrintCount As Integer)
Dim x As Integer
For x = 1 To 23
If Not IsNull("Time" & x) Then
Me("Time" & x).Visible = Me("Time" & x) <> "Other"
Me("Other" & x).Visible = Me("Time" & x) = "Other"
End If
Next x
End Sub
 
For starters I'd be consistent and use Me(). You can probably skip the If and use Nz() in the two lines.
 

Users who are viewing this thread

Back
Top Bottom