473,320 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

After Update on Combo Box

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
2 4213
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dixie | last post by:
I have a form full of subforms which bring summary information onto the form from about 12 different tables. I am trying to get all of that summary information (mainly numbers) into 1 large table...
4
by: CSDunn | last post by:
Hello, I have a combo box (Combo7) that needs to call a function during the After Update event of the combo box. The function resides in an Access 2000 ADP Module called MMAnswerData_code. The...
1
by: flamethrower01 | last post by:
Hi, I have a form (with 4 subforms) which is filtered by 3 combo boxes. Upon loading the form, the form populates fine. After the first combo box, the form works fine. After the second one...
0
by: cefrancke | last post by:
I'm trying to update some combo boxes and subform data (including their combo boxes too.) after inserting a record into a different subform. I insert a record into subformA (tableA is...
3
by: visionstate | last post by:
Hi All, I have put the following code in the 'After Update' of a combo box: Private Sub ComboTeam_AfterUpdate() lblSurnameNotify.Visible = True Me!ComboSurname = Null Me!ComboSurname.Requery...
4
by: Miguel | last post by:
I have an order entry database with two forms. One is for new orders the other is to update orders. The forms are identical except that one is strictly order entry. On both forms are three sets of...
5
by: keri | last post by:
Hi, I am struggling to learn access and VBA whilst creating a db, progress is slow! So far I have managed to run cascading combo boxes on a form by using a sub in the after update procedure of...
4
by: injanib via AccessMonster.com | last post by:
I have a combo box called "Recipient" who's row source is a table called "Main" with three columns. The three columns are "Name", "Floor", "Location". Following the combo box are two fields called...
8
by: jmartmem | last post by:
Greetings, I have an Access 2002 continuous form called "Project Update Form" in which users can update project values presented in a series of combo boxes and text boxes. I have three combo boxes...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.