Text Table Comparison

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have wire size that range from 18 AWG to 750kcmil. The user selects the
Cable Type in the form by FORM![txbxCID08], once slected the Dlookup command
looks up the Wire Size (not shown) and stores the value in the form Wire08.
Which works perfect. Now I want to compare the Wire value selected by the
user to either "1/0" or "2/0" or "3/0" or "4/0" and then do two different
calculations based upon the select. However I cannot get VB to compare the
Wire value (Text based) to "1/0" or "2/0" or "3/0" or "4/0"; regardless of
what is selected it always will exceute the D081B =
Forms!frmCTFill!txbxQAN08.Value * DLookup(" [Cable_DIA]", "tbl600V",
"[Design] = FORM![txbxCID08]") calculation.

If Forms!frmCTFill!Wire08.Value = ("1/0" Or "2/0" Or "3/0" Or "4/0") Then
D081B = Forms!frmCTFill!txbxQAN08.Value * DLookup("
[Cable_DIA]", "tbl600V", "[Design] = FORM![txbxCID08]")
A081B = 0
Else '(600V Single - NEC 391.10(A)(3)) - Triplexed Cables Only
D081B = 0
A081B = Forms!frmCTFill!txbxQAN08.Value * DLookup("
[Cable_A]", "tbl600V", "[Design] = FORM![txbxCID08]")
End If

Any help would be greatly appreciated.
 
In an If statement, you need to repeat the field name:

If Forms!frmCTFill!Wire08.Value = "1/0" Or _
Forms!frmCTFill!Wire08.Value = "2/0" Or _
Forms!frmCTFill!Wire08.Value = "3/0" Or _
Forms!frmCTFill!Wire08.Value = "4/0" Then

Alternatively, you could use an SELECT CASE statement:

Select Case Forms!frmCTFill!Wire08.Value
Case "1/0", "2/0", "3/0", "4/0"
D081B = Forms!frmCTFill!txbxQAN08.Value * DLookup("[Cable_DIA]",
"tbl600V", "[Design] = FORM![txbxCID08]")
A081B = 0
Case Else '(600V Single - NEC 391.10(A)(3)) - Triplexed Cables Only
D081B = 0
A081B = Forms!frmCTFill!txbxQAN08.Value * DLookup("[Cable_A]",
"tbl600V", "[Design] = FORM![txbxCID08]")
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top