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

ImageCombo Before/After Update

TheSmileyCoder
2,322 Expert Mod 2GB
Im trying to have some fun with the imagecombo control, but so far its alot more frustration then it is fun.

From what I have understood I can't tie the imagecombobox directly to a field in a table in the same way I would do with a standard combobox, because what the imagecombobox tries to store is the text property (instead of the key property, however odd that might be)

Therefore I want to store the Key property of the selected item, after it selected. Im therefore looking for a BeforeUpdate in which to "transfer" the selected key value to a hidden field.
Does anyone have a elegant way of doing this? What I have so far is to do this storage in the LostFocus event, but I would like some additional code to run whenever the user has selected an item, and it just looks odd if I run the code when the user clicks somewhere else (I.e. the imagecombo looses focus)

Any suggestions? (And no the imagecombo does not have a built in Before_Update, but im looking for something similar)

If anyone knows a good resource site with imagecombo information, i'd like to know about that too.
Jan 21 '11 #1

✓ answered by ADezii

The following Code, placed in the Click() Event of an ImageCombo Control, will return the Key Value of the Item Selected. Is this what you are looking for?
Expand|Select|Wrap|Line Numbers
  1. Private Sub ImageCombo1_Click()
  2.   MsgBox Me![ImageCombo1].SelectedItem.Key
  3. End Sub

4 3784
ADezii
8,834 Expert 8TB
From what I have understood I can't tie the imagecombobox directly to a field in a table in the same way I would do with a standard combobox
The ImageCombo Control has a Control Source Property and as such can be 'Bound' to a Field in a Table as long as that Table is the Record Source of the Form.
Jan 21 '11 #2
TheSmileyCoder
2,322 Expert Mod 2GB
Yes, it does have a controlsource, but from what I have experimented with it, it will try to store the TEXT (The text displayed in the combobox) value in the bound field.
So say the imagecombo lets me choose between 3 people, all 3 of which is of course in a seperate table, with an Autonumber primary key.
I would like to store the primary key of the person, not the persons name.
Jan 21 '11 #3
ADezii
8,834 Expert 8TB
The following Code, placed in the Click() Event of an ImageCombo Control, will return the Key Value of the Item Selected. Is this what you are looking for?
Expand|Select|Wrap|Line Numbers
  1. Private Sub ImageCombo1_Click()
  2.   MsgBox Me![ImageCombo1].SelectedItem.Key
  3. End Sub
Jan 21 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Thank you very much, that worked.
I didn't consider using that as it was not one of the options given when looking at the Events tab of the combobox's properties.
Jan 24 '11 #5

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: branton ellerbee | last post by:
what is the problem with this pos language? I have run into this problem time and time again and never sure what I do to fix it. I have a update to a database, then I call sub to re-bind the...
6
by: Dugo | last post by:
I'm trying to use a "keypad" form (with command buttons for numbers 0 thru 9) I developed to allow users to first click a textbox on one form, then click a number on the keypad and have the value...
2
by: marty | last post by:
I did some searchs, but can't find the answer to my problems. I have a editable DataGrid. I do an update of one of the rows. Postback "OnUpdateCommand" Call Oracle proc to do that actual...
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...
1
by: Dave | last post by:
I'm having problems with certain fields that I force an update (Me.dirty=false) in the After Update Event I lose focus of the field where the user was or where he clicked help Is there a way...
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...
0
by: Mangler | last post by:
I have a form that does multiple updates on the page. For some reason that I cant figure out it is redirecting before the update is done. It doesnt do this on another page that I have. <% If...
1
by: HenHouse | last post by:
Hi all; I think I've asked this question before but it looks like I'm going to need a deeper understanding of the problem rather than just a quick fix... I have three tables represented by three...
4
by: phill86 | last post by:
Hi, i have a form that runs a query in a recordset on the after update method if i copy and paste one record at a time the query picks up the records in the underlying table but if i paste...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.