Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If/Else Problem 1

Status
Not open for further replies.

rj51cxa

Technical User
Mar 16, 2006
216
GB
I am trying to update a Yes/No field [fPetersPrize] based on an entry in ComboBox [TxtRank-Rating]. There are 32 entries in the underlying table for TxtRank-Rating of which 10 will make [fPetersPrize] true, the remainder will make it false.

I have placed the following code in the OnChange Event of the [TxtRank-Rating] but every time I run it I get the warning "Block If without End If". I have tried various combinations but end up with the same result.

Code:
If [TxtRank_Rating] = "A/S/LT" Then
[fPetersPrize] = True
If [TxtRank_Rating] = "AB" Then
[fPetersPrize] = True
If [TxtRank_Rating] = "MID" Then
[fPetersPrize] = True
Else
[fPetersPrize] = False
End If

I'm obviously coding it wrong and would appreciate some help with sorting it out.

Thanks a lot
John
 
If [TxtRank_Rating] = "A/S/LT" Then
[fPetersPrize] = True
[!]Else[/!]If [TxtRank_Rating] = "AB" Then
[fPetersPrize] = True
[!]Else[/!]If [TxtRank_Rating] = "MID" Then
[fPetersPrize] = True
Else
[fPetersPrize] = False
End If

Another way:
Select Case [TxtRank_Rating]
Case "A/S/LT", "AB", "MID"
[fPetersPrize] = True
Case Else
[fPetersPrize] = False
End Select

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV,

That did it.

Best Regards
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top