If / Elseif
Nov 4, 2004
Can someone please look at my code and help me understand why it isn't working?
Code:Private Sub Text113_Enter()If [current retailer] = "One" And ([peakusage] + [offpeakusage] + [controlledloadusage]) > 40000 And ([one] - [total]) < 0 Then meter_type = "B Meter"ElseIf [current retailer] = "One" And ([peakusage] + [offpeakusage] + [controlledloadusage]) > 40000 And ([one] - [total]) >= 0 Then meter_type = "5 Meter"ElseIf [current retailer] = "Two" And ([peakusage] + [offpeakusage] + [controlledloadusage]) > 40000 And ([two] - [total]) < 0 Then meter_type = "B Meter"ElseIf [current retailer] = "Two" And ([peakusage] + [offpeakusage] + [controlledloadusage]) > 40000 And ([two] - [total]) >= 0 Then meter_type = "5 Meter"ElseIf [peakusage] + [offpeakusage] + [controlledloadusage] <= 40000 Then meter_type = "B Meter"End IfEnd Sub
Everytime I try to run this code to store it in my field(meter_type), I get the "Else without If" error, but I can't see where I'm going wrong! Anyone??
View Replies
Nov 6, 2005
I have been using the following in AfterUpdate event of "MyField1". This has worked ok enabling and disabling one field which in this case is named Myfield2. Now I want to enable and disable multiple fields based on text content of "MyField1" and am not sure what to do. MyField1 is a combo. I've searched about but can't find anything to point me in the right direction. Any suggestions?
If Me.Myfield1 = "mytext" Then
Me.Myfield2.Enabled = True
ElseIf Me.Myfield1 = "someothertext" Then
Me.myfield2.Enabled = True
Else
Me.myfield2.Enabled = False
End If
End Sub
View 5 Replies
View Related
May 31, 2006
i have the following query statement:
intext: IIf([calllogs]![InternalCall],"0","External")
in "InternalCall" there is either a "0" or a "1", these represent external and internal calls
So I want to turn the "1" and "0" into "internal" and "external"
I've done half of it, but I can't use an "else if" statement in the query, the only other option is to have one field for internal and one box for external with seperate iif statements which I want to stay away from...
View 3 Replies
View Related
Jan 24, 2005
Heelo all:
Code:
Private Sub GPA_AfterUpdate()
If Division = "GRADUATE" Then
Honors = ""
ElseIf Division = "UNDERGRADUATE" And GPA < 3.2 Then
Honors = ""
ElseIf GPA >= 3.2 And GPA < 3.5 Then
Honors = "CUM LAUDE"
ElseIf GPA >= 3.5 And GPA < 3.8 Then
Honors = "MAGNA CUM LAUDE"
ElseIf GPA >= 3.8 Then
Honors = "SUMMA CUM LAUDE"
End If
If Division = "GRADUATE" And School = "SCHOOL OF EDUCATION" And GPA >= 3.7 Then
Honors = "HONORS"
MsgBox "PLEASE MAKE SURE STUDENT HAS ONLY A'S AND B'S ON TRANSCRIPT!"
End If
End Sub
Does anyone know hoe to convert the above statements into using SELECTCASE statements?
Any help is most welcome.
Thanks in advance,
Dee
View 1 Replies
View Related