473,387 Members | 1,582 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,387 software developers and data experts.

Set field value on after update event of combo box

67 64KB
Hi,
I have a point that I don't know how to do it. My form is bounced to a table but not all fields of table have on form. There is a combo box which retrieve three column value. On combo box after update event, I want to use its column count(2) assign to a table field that doesn't have control on form.

Could anybody tell me how to do this

Sophanna
Aug 15 '14 #1

✓ answered by jimatqsi

So, obviously one choice would be to put field d on the form, bound to a textbox or combobox. Then in the original combobox after_update event you could set the value of the new object to that combobox value. But then, why not just update the new object directly? What's the point of having this original combobox.

Oh, you did say the original combobox is already bound to a field. You can't bind it to two fields, so yes, the after_update event is the way to go.

You can hide the field d object; just set the Visible property to no. That way it will be on the form, bound to some new textbox that can't be seen, and you can easily update it with a simple
Expand|Select|Wrap|Line Numbers
  1. me.fieldD_txt = me.OriginalComboBox
  2.  
Something like that, just use the object names that you use on your form.

Jim

7 12603
jimatqsi
1,271 Expert 1GB
sophannaly,
If I understand your question right, you want to code something like this:
Expand|Select|Wrap|Line Numbers
  1. me.some_field_on_the_form=me.combobox.Column(2)
some_field_on_the_form refers to the field you are trying to update
and combobox refers to the name of the combobox with the 3 columns. The first column of a combobox is Column(0), the 3rd column is Column(2)

Jim
Aug 15 '14 #2
sophannaly
67 64KB
Hi Jim,

Thanks for your reply. But my problem is I would like to send combo box column(2) to a field in table which I didn't assign any textbox or combo box on form. For example, my table fields are a, b, c, d. On form, I have assign combo box which bound to field a, text field for b and c. After combo box A is selected, I would like to use after update even on combo box and send it column(2) value to field d. And this form is bound to that table.

Could you tell me how could I archive this?

Sophana
Aug 15 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Sophanally,

I have to say that I am thoroughly confused. If you have a table with fields a, b, c and d, I don't understand how the combo box is bound to field a, but also fields b and c?!?!?!

Then, field d is somehow to be updated based on the combo box? It doesn't seem like you are accomplishing anything, other than making field d equal to one of the other fields. Please explain a little better, because I'm not sure this makes any sense otherwise.
Aug 15 '14 #4
jimatqsi
1,271 Expert 1GB
So, obviously one choice would be to put field d on the form, bound to a textbox or combobox. Then in the original combobox after_update event you could set the value of the new object to that combobox value. But then, why not just update the new object directly? What's the point of having this original combobox.

Oh, you did say the original combobox is already bound to a field. You can't bind it to two fields, so yes, the after_update event is the way to go.

You can hide the field d object; just set the Visible property to no. That way it will be on the form, bound to some new textbox that can't be seen, and you can easily update it with a simple
Expand|Select|Wrap|Line Numbers
  1. me.fieldD_txt = me.OriginalComboBox
  2.  
Something like that, just use the object names that you use on your form.

Jim
Aug 15 '14 #5
sophannaly
67 64KB
Hi Jim,

Thanks you so much for your idea and it helps.

Sophanna
Aug 17 '14 #6
NeoPa
32,556 Expert Mod 16PB
@Sophana.
If you already have a field that you can use to determine the value you want stored - then you should not be thinking about storing that value too. This is un-normalised data - and that's a bad thing in relational databases. See Database Normalisation and Table Structures for more on that.
Aug 18 '14 #7
sophannaly
67 64KB
Hi NeoPa,

Thanks for your idea. The table that I do data entry, there is a foreign key reference to table that has two fields (code+level) combine together as PK. So in reference table, we also need to use these two fields as foreign key. On data entry form, I just let user choose only code from drop down list (dropdown list display data: code, level, description). After user choosing code, then I will store level automatically (each code refer to only one level, and there are some codes that has duplicate value but it is in different level, so I need to combine these two fields together as PK).

Sophanna
Aug 20 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: David | last post by:
Hi I use a calendar to update a field and the after update event no longer works, if i manually update it there is not a problem. How can I get this event to trigger Thanks in advance Dave
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...
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: Mikep99 | last post by:
I am new to access and need some help with coding. I have a main form XYZ with 2 subforms. I have a checkbox on subform1 "frmExpediteS" that when checked i would like the Value in Feild "PO" of this...
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...
3
by: sylver | last post by:
To convert "12q" to "12": var text = "12q"; var twelve = parseInt(text); //twelve == 12 or you can user parseFloat()..depends on your needs :D
2
by: franc sutherland | last post by:
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....
5
by: Zeeshan7 | last post by:
After Update Event Procedure on a form is not working after upsizing database to SQL server. Anything to add in below code as it generate run time error 3622 "You must use the dbSeeChanges option...
6
by: Jeffrey Tan | last post by:
i have this code in a combo box after update event. what it's supposed to do is open the User Problem Log form and go to the specific record. I have this combo box on another form. trouble no...
3
by: Sandra Walsh | last post by:
I have a form called f_Dashboard which has the following code on the AfterUpdate() event of an unbound field called SelectCityAllTrips. This code opens a filtered set of records in f_MainTripForm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.