Form with image related to a combobox selection

Richard1980

Registered User.
Local time
Today, 08:44
Joined
Aug 13, 2012
Messages
72
Hello, I need your help on this item.
I have a table (tblCountries) with world countries and their respective flags. The tblCountries.Flag is an attachment field type. I have another table (tblAirports) where there is a combobox for selecting airport country. I would like to display in the form (frmAirports) the flag for the country selected by the combobox. The flag shown must obviously come from the tblCountries.Flag field.
How do that?
Thanks, bye

Riccardo
 
Perhaps the attached sample will give you some pointers.

Be sure to copy the DB and the folder "Flags to the same location.
 

Attachments

Hello John,
thanks for your reply. It is an interesting sample, but I am looking for something better. However, it can be the starting point for something more advanced... Bye.
 
Can you explain to us what you mean by "better and more advanced" in this context?
 
Yes, for sure. In the John's sample there is for every Japan region/prefecture its own flag name (XYZ.png) written in the main table using a text type field. Then the query takes every name to build the local machine address where are stored all flags.
Now, due to a large number of countries (close to 200) in my DB, it is quite expensive in terms of time writing the name of all flags in a table.
Any suggestions from you, Access gurus?
 
So how do you intend mapping to the country's flag if you don't have a table containing this map?
 
Well with these kind of things there's got to be some Admin tasks involved. You will need to create a mapping table or if you have the images in your db already and each image is identifiable with a meaningful name then it can be done.
 
I don't know...

Perhaps the Data entry fairy ;)

Seriously though, you probably only need the Country name, and so long as the country flag file name matches the country name in in your table and they all have a consistent file extension you can simply append that in the code that is building the file path.
 
...alternately you could use an append query to create the record with the file extension on it. There are so many ways to reduce the amount of KP work you need to do if you sit and look for a solution rather than becoming fixated on the problem ;)
 
Ok, I have been able to store the file name for every country flag. Now I have a table with country names, flags and filenames. So, next step is to use John's sample to get the image for the airport country. All flags are (for now) stored within the database, not in an external folder (as for John's one) but let's try and see what happens. Thanks for your suggestions. Bye.

Riccardo
 

Users who are viewing this thread

Back
Top Bottom