Results 1 to 5 of 5
  1. #1
    ron727 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2009
    Posts
    7

    Combo Box to automatically update picture

    Hi All, I have a data base whith a table called CountryList used as the source to populate a combobox in order to choose a country. The combo box also incudes a field that is an attachment with a pictre of the county's flag.I would like that when I choose a country in the combobox in my form that my Image conrol displays the picture of the flag.



    I have added the following code the the after update() of the combobox

    Private Sub Combo16_AfterUpdate()
    Me.Image27.Picture = Me.Combo16.Column(2)
    End Sub

    the problem is when i choose a country with a flag i get error "2220" Access cannot open Canada.bmp file.

    If i choose a country with no attached flag i get no error msg.

    The problem is obviously with opening the file because it always links to the proper attached *.bmp file but it says it can't open it.

    Any Ideas?

  2. #2
    ansentry's Avatar
    ansentry is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    May 2009
    Location
    Melbourne, Australia
    Posts
    67
    Ron,

    That error says that Access can't open the file.

    In the table that is the source for your combo box do you have the path (location) of the .bmp file?

    If so is it entered like this? (No " " )

    C:\Flags\Canada.bmp
    If you still have problems post back and I will post an sample for you.

    Regards,

    John A

  3. #3
    ron727 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2009
    Posts
    7
    Hi John, Thanks for the reply.

    The bmp file is located the in source table for the combobox called CountryList as an Attachment field type. The file is not linked it is embeded in the combobox source table.

    Is that what you wanted to know?

    Listen i am new to Access, am i doing this right or do you have a suggestion as a better way to go about it

    Please note that I am using Access 2007 so i have the Attachment field type

    Thanks

    regards
    Ron

  4. #4
    ansentry's Avatar
    ansentry is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    May 2009
    Location
    Melbourne, Australia
    Posts
    67
    Ron,

    I feel that you should not store images in Access, it will lead to the file being very large. The best method is to store them in a folder on your one of your drives (C:\ or D:\ etc)

    I have attached a sample db that requires the following;

    Folder on c:\ drive to be called Flags (C:\Flags)
    In that folder put 2 .jpg files and call them Australia.jpg & Canada.jpg
    ( I just go a couple of small JPG files from Google/Images)

    Now you can open the Access program and select from the combo box which counties flag you want to display.

    Now if you require the flag section to be associated with say a customers name that is another small step, I have not done this in my sample as you did not state in the post what you wanted to "do" with image once it had been selected.


    Regards,

    John A

    Regards,

    John A

  5. #5
    ron727 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2009
    Posts
    7
    Ok Thank you i will try that thank you so much for your help

    i really appreciate it

    regards

    Ron

Please reply to this thread with any new information or opinions.

Similar Threads

  1. linking forms by ID - automatically add ID
    By jlcaviglia-harris in forum Forms
    Replies: 0
    Last Post: 04-17-2009, 03:51 PM
  2. Update a combo box in real time
    By protean_being in forum Forms
    Replies: 0
    Last Post: 05-17-2008, 07:39 AM
  3. Have database open automatically
    By Norman Masson in forum Access
    Replies: 6
    Last Post: 01-08-2008, 07:41 AM
  4. After Update for a second Combo box
    By nywi6100 in forum Forms
    Replies: 0
    Last Post: 10-23-2006, 03:07 PM
  5. automatically create queries
    By GEORGIA in forum Programming
    Replies: 8
    Last Post: 01-23-2006, 02:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums