Results 1 to 9 of 9
  1. #1
    ricky99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Location
    Italy
    Posts
    16

    working with attachment field type

    Hello Gents,
    I have a table with name of countries and an attachment field type where I store for every nation its own flag (a small .png file). Then I have a form (bound to another table) where I call by a combobox the name of one country. I would like to show the respective flag in a specific field, after the country has been choosen.
    So, I wonder:
    1. If I can manage this action using DLookup function or if there is a better way to display it.
    2. in the form, what field type I should use for the flag will be displayed.

    Many thanks, bye.

    Riccardo

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    The combobox is bound to field? Make the form RecordSource a query that joins the two tables, jointype: Include all records from <tablename> and only those records from Countries that are equal.

    Bind ControlSource of Image control to the Countries attachment field.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ricky99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Location
    Italy
    Posts
    16
    Honestly, I didn't understand your suggestion, I am a newbie. I am not telling it is not a good idea, but I cannot understand how to perform what you told me.
    The combobox is bound to the field in tblAirports, then I have a tblCountries where there are all countries stored with them respective flags.
    Which fields I have to join between tblAirports and tblCountries?
    Bye.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    You have a field in tblAirports to save the country code or ID from tblCountries? The field in tblAirports is foreign key that relates to the primary key ID field in tblCountries. Build a query that joins these two tables on those two fields, select the jointype I described. This is very basic Access functionality and Access Help has guidelines on using the query designer.

    The combobox should be bound to the field in tblAirports but the RowSource will be tblCountries.

    If you need a better understanding of relational database concepts, review:
    http://forums.aspfree.com/microsoft-...es-208217.html
    http://www.developerbarn.com/communi...-database.435/
    Last edited by June7; 09-15-2012 at 02:57 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ricky99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Location
    Italy
    Posts
    16

    getting error 3341

    Hello, I have tried but I get an error (3341) when select from combobox the country name. While, if I fill the airport name field, save the record, then return to it, the combobox works and the attachment field loads the correct flag.
    Furthermore, if I delete the airport name field the form works well, no error.
    Any idea? What's wrong?
    Thanks, bye.

    Riccardo

    FSX.zip

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    So, looks like purpose of this form is to edit/create airport records. I am not getting error when I select country in combobox. Sorry, it works just fine for me.

    I was curious about the image control. It has Enabled and Locked properties. When I add an Image control to form those properties are not available and the flag does not display. First time I have encountered this issue. However, when I use form wizard to build a form on the Flags table, the image control has those properties and the flag displays. Interesting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    ricky99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Location
    Italy
    Posts
    16
    Quote Originally Posted by June7 View Post
    So, looks like purpose of this form is to edit/create airport records. I am not getting error when I select country in combobox. Sorry, it works just fine for me.
    The combobox works well when you try to change countries for airport records already saved. But try to save a new record, you'll meet the error. You should save only the airport name with no country information (blank), move to the next record, then return to the previously recorded one and then the combobox works.

    I was curious about the image control. It has Enabled and Locked properties. When I add an Image control to form those properties are not available and the flag does not display. First time I have encountered this issue. However, when I use form wizard to build a form on the Flags table, the image control has those properties and the flag displays. Interesting.
    It is not an image control, it is an attachment field type control.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I did try creating a new record. It works, no error. I did nothing to modify your db. I downloaded and tested. No error.

    I don't use attachment fields, just done some testing with them. I just again tested the Image control in a db of mine and does display the image. Don't know why can't make it work in your db. However, dragging the attachment field onto the form from the field list creates the control with the Locked and Enabled properties and the field is editable. The Image control is not. This might be new with 2010. I will have to check with 2007 version.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    ricky99 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Location
    Italy
    Posts
    16
    very strange indeed, it do works with MS Access 2010 and not with 2007. I will give a try this afternoon with MS Access 2010.
    Anyway, I don't know how to use the image control to display an image of an attachment field type, just did it but no chanche to work.
    My target is having a table where all countries' flags are stored (which I already have), to share them in different tables.


    FSX v2.zip

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

Similar Threads

  1. Replies: 3
    Last Post: 07-21-2012, 10:20 PM
  2. PDF Attachment working for some, not all
    By BezAcess in forum Access
    Replies: 3
    Last Post: 05-01-2012, 02:15 PM
  3. Replies: 16
    Last Post: 04-30-2012, 07:12 AM
  4. Replies: 5
    Last Post: 07-18-2011, 06:07 PM
  5. Attachment data type INSERT INTO not working
    By LouisLouis in forum Programming
    Replies: 0
    Last Post: 09-27-2009, 02:23 PM

Tags for this Thread

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