peskywinnets
Registered User.
- Local time
- Today, 15:25
- Joined
- Feb 4, 2014
- Messages
- 582
What's the easiest (or best!) way to update an existing table column called ECorNOT" with a result as to whether the country (listed on the same access 'row') is in the EC or not?
here's the result I seek...
I tried an update query, but there are too many countries in the EC to test against using an acceess IIF command, so I'm figuring that it'll probably need some VBA code.
Here's what I'm thinking...
...but being new to VBA (& Access) I don't know how to select the actual database *and* column that has the country name in it (which in my case is [Sales]![BillingCountry] to test against!
...top tips warmly received on the best approach!
here's the result I seek...
Code:
[B]Country[/B] [B] EC or Not[/B]
United Kingdom EC
Germany EC
France EC
Australia nonEC
I tried an update query, but there are too many countries in the EC to test against using an acceess IIF command, so I'm figuring that it'll probably need some VBA code.
Here's what I'm thinking...
Code:
If [Sales]![BillingCountry] = "Austria" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Belgium" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Bulgaria" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Croatia" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Cyprus" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Czech Republic" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Denmark" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Estonia" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Finland" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "France" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Germany" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Hungary" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Ireland" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Italy" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Latvia" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Lithuania" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Luxembourg" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Malta" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Netherlands" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Poland" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Portugal" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Romania" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Slovakia" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Slovenia" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Spain" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "Sweden" Then
[ECorNot] = "EC"
ElseIf [Sales]![BillingCountry] = "United Kingdom" Then
[ECorNot] = "EC"
Else
[ECorNot] = "nonEC"
End If
...but being new to VBA (& Access) I don't know how to select the actual database *and* column that has the country name in it (which in my case is [Sales]![BillingCountry] to test against!
...top tips warmly received on the best approach!