craigachan
04-28-2008, 09:25 PM
Hi have a form that has controls named 1,2,3 .....80. I also have in the same form controls that are named A, B, C, .... T. Associated with these controls are boxes and lines that are used for graphical effect such as B1, L1, E1 that area associated with control "1". I want to evaluate the field data and change the control's properties in only the fields named after numbers but exclude the fields named after letters.
I have code that loolps thru 1 - 80 where:
Param = "field name"
ParamB = "B" (for a box, eg. box named B2)
ParamE = "E"
ParamL = "L" (for a line, eg line named L2)
Control "aa" = blank field used to help move focus
frtogSuper = option group
Here is the non-loop part of the code:
If Me(Me.ParamB & [Param]).Visible = False And Me.frtogSuper = 1 And [Param] > 50 Then
Me(Me.ParamB & [Param]).Visible = True
If Me(Me.ParamE & [Param]) = "B/C" Then
Me(Me.ParamL & [Param]).Visible = False
Else
Me(Me.ParamL & [Param]).Visible = True
End If
Me(Me.ParamE & [Param]).Visible = True
Me(Me.ParamMs & [Param]).Visible = True
Me(Param).Caption = [Param]
Me(Me.ParamT & [Param]) = "y"
DoCmd.GoToControl "aa"
Exit Function
End If
If Me(Me.ParamB & [Param]).Visible = True And Me.frtogSuper = 1 And [Param] > 50 Then
Me(Me.ParamB & [Param]).Visible = False
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamE & [Param]).Visible = False
Me(Me.ParamMs & [Param]).Visible = False
Me(Me.ParamT & [Param]) = "n"
Me(Param).Caption = " "
DoCmd.GoToControl "aa"
End If
If Me(Me.ParamB & [Param]).Visible = False And Me.frtogSuper = 2 And [Param] < 50 Then
Me(Me.ParamB & [Param]).Visible = True
If Me(Me.ParamE & [Param]) = "B/C" Then
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamB & [Param]).BackColor = RGB(255, 125, 0)
Else
Me(Me.ParamL & [Param]).Visible = True
End If
Me(Me.ParamE & [Param]).Visible = True
Me(Me.ParamMs & [Param]).Visible = True
Me(Me.ParamT & [Param]) = "y"
DoCmd.GoToControl "aa"
Exit Function
End If
If Me(Me.ParamB & [Param]).Visible = True And Me.frtogSuper = 2 And [Param] < 50 Then
Me(Me.ParamB & [Param]).Visible = False
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamMs & [Param]).Visible = False
Me(Me.ParamE & [Param]).Visible = False
Me(Me.ParamT & [Param]) = "n"
DoCmd.GoToControl "aa"
End If
This all works great for the numbered controls and their associated graphical elements, But my problem is that the lettered fields are also evaluated.
I'm wondering how I exclude those controls that are lettered. Example: I want to change the properties for 1, B1, L1, and E1, but leave A, bA, LA, and eA alone.
For some reason my code includes the letters. Any Ideas?
I have code that loolps thru 1 - 80 where:
Param = "field name"
ParamB = "B" (for a box, eg. box named B2)
ParamE = "E"
ParamL = "L" (for a line, eg line named L2)
Control "aa" = blank field used to help move focus
frtogSuper = option group
Here is the non-loop part of the code:
If Me(Me.ParamB & [Param]).Visible = False And Me.frtogSuper = 1 And [Param] > 50 Then
Me(Me.ParamB & [Param]).Visible = True
If Me(Me.ParamE & [Param]) = "B/C" Then
Me(Me.ParamL & [Param]).Visible = False
Else
Me(Me.ParamL & [Param]).Visible = True
End If
Me(Me.ParamE & [Param]).Visible = True
Me(Me.ParamMs & [Param]).Visible = True
Me(Param).Caption = [Param]
Me(Me.ParamT & [Param]) = "y"
DoCmd.GoToControl "aa"
Exit Function
End If
If Me(Me.ParamB & [Param]).Visible = True And Me.frtogSuper = 1 And [Param] > 50 Then
Me(Me.ParamB & [Param]).Visible = False
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamE & [Param]).Visible = False
Me(Me.ParamMs & [Param]).Visible = False
Me(Me.ParamT & [Param]) = "n"
Me(Param).Caption = " "
DoCmd.GoToControl "aa"
End If
If Me(Me.ParamB & [Param]).Visible = False And Me.frtogSuper = 2 And [Param] < 50 Then
Me(Me.ParamB & [Param]).Visible = True
If Me(Me.ParamE & [Param]) = "B/C" Then
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamB & [Param]).BackColor = RGB(255, 125, 0)
Else
Me(Me.ParamL & [Param]).Visible = True
End If
Me(Me.ParamE & [Param]).Visible = True
Me(Me.ParamMs & [Param]).Visible = True
Me(Me.ParamT & [Param]) = "y"
DoCmd.GoToControl "aa"
Exit Function
End If
If Me(Me.ParamB & [Param]).Visible = True And Me.frtogSuper = 2 And [Param] < 50 Then
Me(Me.ParamB & [Param]).Visible = False
Me(Me.ParamL & [Param]).Visible = False
Me(Me.ParamMs & [Param]).Visible = False
Me(Me.ParamE & [Param]).Visible = False
Me(Me.ParamT & [Param]) = "n"
DoCmd.GoToControl "aa"
End If
This all works great for the numbered controls and their associated graphical elements, But my problem is that the lettered fields are also evaluated.
I'm wondering how I exclude those controls that are lettered. Example: I want to change the properties for 1, B1, L1, and E1, but leave A, bA, LA, and eA alone.
For some reason my code includes the letters. Any Ideas?