powersp68232
New Member
- Joined
- Apr 24, 2018
- Messages
- 12
I have an If ElseIf in VBA and the code runs when I click a button. I have an unbound textbox [text97] that the VBA fills and a textbox [text63] that its default value = [text97]. When running the code, [text97] shows the correct value, but [text63] equals “”. If I comment out all the ElseIf statements it works as it should. I’m really stumped. Any help would be greatly appreciated. My code is as follows:
Code:
[COLOR=#000000][FONT=Arial]
If Me!txtTranBOM Like "1094.*" Then[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial] Me!Text97 = "HCU BOM: " & Me!txtHCUBOM & " S/N: " & Me!txtHCUSN & vbCrLf & "TCU BOM: " & Me!txtTCUBOM & " S/N: " & Me!txtTCUSN & vbCrLf & "Sensor Unit BOM: " & " S/N: "[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]ElseIf Me!txtTranBOM Like "1087.*" Then[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Me!Text97 = "Mech BOM: " & Me!txtHCUBOM & " S/N: " & Me!txtHCUSN & vbCrLf & "E-Mod BOM: " & Me!txtTCUBOM & " S/N: " & Me!txtTCUSN[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]ElseIf Me!txtTranBOM Like "1112.*" Then[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Me!Text97 = "HCU BOM: " & Me!txtHCUBOM & " S/N: " & Me!txtHCUSN & vbCrLf & "TCU BOM: " & Me!txtTCUBOM & " S/N: " & Me!txtTCUSN & vbCrLf & "Sensor Unit BOM: " & " S/N: "[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]ElseIf Me!txtTranBOM Like "1102.010*" Then[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial] Me!Text97 = "Mech BOM: " & Me!txtHCUBOM & " S/N: " & Me!txtHCUSN & vbCrLf & "E-Mod BOM: " & Me!txtTCUBOM & " S/N: " & Me!txtTCUSN[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]Me!Text63 = Me!Text97[/FONT][/COLOR]
[COLOR=#000000][FONT=Arial]End If[/FONT][/COLOR]