Tech Support Guy banner

ElseIf Usage

1234 Views 2 Replies 3 Participants Last post by  AbvAvgUser
I have the following code that selects which db the data gets posted to:

Code:
If varBusName = "Citi" Then
Select Case varYrA
Case "2002"
varDB = "Training_Delivery_Data.mdb"
'more Cases for each year
End Select

Else
Select Case varYrA
Case "2002"
varDB = "Training_Delivery_DataSears.mdb"
'more Cases for each year
End Select
End If
I am having trouble with users leaving either the year or the business blank - in this case the code is defaulting to the Else choice and posting to the wrong db. I was wondering if I could handle the problem this way:

Code:
If varBusName = "Citi" Then
Select Case varYrA
Case "2002"
varDB = "Training_Delivery_Data.mdb"
'more Cases for each year
End Select

ElseIF varBusName = "Sears" Then
Select Case varYrA
Case "2002"
varDB = "Training_Delivery_DataSears.mdb"
'more Cases for each year
End Select

Else
'Redirect to an Error Page instructing them to make a choice in the dropdowns

[I][B]How do I get it to check for both values before posting?[/B][/I]

End If
See less See more
Status
Not open for further replies.
1 - 1 of 3 Posts
1 - 1 of 3 Posts
Status
Not open for further replies.
Top