By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

After Update on Combo Box

P: n/a
Hello,

I have a form which people use to add customers. One of the fields is
"country".

Most of the clients are in the UK, but we have the requirement to have
it spelt out as United Kingdom.

Currently, the country is selected using a combo box which is
connected to a query which pulls through the countries from a table.
I wanted to use the After Update action so that if someone entered
"UK", it would automatically replace it with "United Kingdom".

I used this code:

If cbo.value = "uk" or "UK" then
cbo.value = "United Kingdom"
End If

It gives error 13, type mismatch. I'm guessing that this means the
combo box is using an index value rather than the text value, although
there is only one column (i.e. the text value) in the underlying
query.

Is this what's happening?

Can anyone suggest a way to automate the text replacement?

Many thanks,

Franc.
Sep 8 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 8 Sep 2008 06:02:26 -0700 (PDT), franc sutherland
<fr**************@googlemail.comwrote:

No the error is caused by bad syntax. This code will not compile until
you rewrite as:
If cbo.value = "uk" or cbo.value = "UK" then
cbo.value = "United Kingdom"
End If

Some simpler solutions come to mind, such as:
* Change the entry in the Country table from UK to United Kingdom
* Have two columns in the table, one for country abbreviation and one
for country name.
* Have a default value in that field of "United Kingdom"

-Tom.
Microsoft Access MVP
>Hello,

I have a form which people use to add customers. One of the fields is
"country".

Most of the clients are in the UK, but we have the requirement to have
it spelt out as United Kingdom.

Currently, the country is selected using a combo box which is
connected to a query which pulls through the countries from a table.
I wanted to use the After Update action so that if someone entered
"UK", it would automatically replace it with "United Kingdom".

I used this code:

If cbo.value = "uk" or "UK" then
cbo.value = "United Kingdom"
End If

It gives error 13, type mismatch. I'm guessing that this means the
combo box is using an index value rather than the text value, although
there is only one column (i.e. the text value) in the underlying
query.

Is this what's happening?

Can anyone suggest a way to automate the text replacement?

Many thanks,

Franc.
Sep 8 '08 #2

P: n/a
On Sep 8, 2:38*pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Mon, 8 Sep 2008 06:02:26 -0700 (PDT), franc sutherland

<franc.sutherl...@googlemail.comwrote:

No the error is caused by bad syntax. This code will not compile until
you rewrite as:
If cbo.value = "uk" or cbo.value = "UK" then
* cbo.value = "United Kingdom"
End If

Some simpler solutions come to mind, such as:
* Change the entry in the Country table from UK to United Kingdom
* Have two columns in the table, one for country abbreviation and one
for country name.
* Have a default value in that field of "United Kingdom"

-Tom.
Microsoft Access MVP


Hello,
I have a form which people use to add customers. *One of the fields is
"country".
Most of the clients are in the UK, but we have the requirement to have
it spelt out as United Kingdom.
Currently, the country is selected using a combo box which is
connected to a query which pulls through the countries from a table.
I wanted to use the After Update action so that if someone entered
"UK", it would automatically replace it with "United Kingdom".
I used this code:
If cbo.value = "uk" or "UK" then
cbo.value = "United Kingdom"
End If
It gives error 13, type mismatch. *I'm guessing that this means the
combo box is using an index value rather than the text value, although
there is only one column (i.e. the text value) in the underlying
query.
Is this what's happening?
Can anyone suggest a way to automate the text replacement?
Many thanks,
Franc.
Whoops!
Thanks Tom, that's sorted that.
All the best,
Franc.
Sep 8 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.