Results 1 to 2 of 2
  1. #1
    tammiep is offline Novice
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    4

    Image Linked In Vba Not Displayed In Form's OnCurrent

    I'm wondering if someone can shed some light on a problem that I am baffled by.



    I have a main form (frmTherapy) within which are 8 hidden subforms. Each subform becomes visible depending on user selection. One of these subforms is called sbfrmTracheostomy. It collects information about the patient's tracheostomy, including the tracheostomy tube. A combobox (cboTracheostomyBrand) displays various trach brands from a lookup table. Depending on the brand of trach, the second combobox (cboTracheostomyType) lists various tubes sold by that company. This second combobox is populated by another lookup table which contains TrachTypeID, TrachName and PicturePath (the path to images for each trach tube). I put the following code: Me!MyPicture.Picture = Me!PicturePath in the cboTrachType AfterUpdate event. This all works fine. In order for the image to be displayed when the form is loaded, I placed this same line of code in the Form's OnCurrent event.

    Here's my problem: on the main form "frmTherapy", when any subform other than the tracheostomy subform is chosen by the user, I'm getting the error "Type Mismatch" a total of 3 times. When I remove the line: Me!MyPicture.Picture = Me!PicturePath from sbfrmTracheostomy's Form_Current event, everything works fine, except that the picture is not displayed on the tracheostomy subform anymore. I can't figure out why this particular code in this one subform's OnCurrent event is affecting loading of all other subforms.

    Is there something I'm overlooking?

    Thanks for any help.

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Quote Originally Posted by tammiep View Post
    I can't figure out why this particular code in this one subform's OnCurrent event is affecting loading of all other subforms.
    This sub form is not really affecting loading of all other subforms. It is caused by the parent form.

    When the parent form loads it also loads all the sub forms with data. Even if the are not visible. So when the parent form load all the sub forms must be able to load without issue.

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

Similar Threads

  1. Form's Criteria used in Crosstab
    By onechriswhite in forum Queries
    Replies: 8
    Last Post: 08-27-2010, 05:48 PM
  2. Linked Image on Form
    By jheintz57 in forum Forms
    Replies: 0
    Last Post: 03-31-2010, 12:04 PM
  3. OnCurrent error
    By dreamweaver547 in forum Security
    Replies: 1
    Last Post: 03-14-2010, 01:45 PM
  4. New JPGs Not Displayed
    By DJMoore in forum Access
    Replies: 1
    Last Post: 11-15-2009, 05:30 AM
  5. JPEG isn't displayed in forms
    By GeorgeILPS in forum Access
    Replies: 0
    Last Post: 01-14-2008, 12:21 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