Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Forms

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-16-2009, 10:07 AM
mamba716 mamba716 is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jun 2009
Posts: 4
mamba716 is on a distinguished road
Default Error displaying image on form

Hi all,

I am currently creating a small database in Access 2003. It is similar to an employee or contact information database. I liked the feature on the sample Northwind database that allowed you to display an employee's image on the form next to their information, so I tried to replicate it. Here is my issue:

I copied and pasted all of the VBA code, then went through the form and added the image frame, text box, command buttons, and error message, then added [Event Procedure] in control properties where appropriate, made sure the references in Visual Basic matched up, changed the images to .bmp format... basically everything I could think of to make the image feature identical to the one in Northwind. All of the code compiled without error, but when I click the Add/Change button and select the image that I would like to display, the image frame is blank. The image path looks to be correct. I even reduced the file size incase the image was too large. Still nothing. I'm relatively new to Access and am not sure what else to do. Anyone have any ideas of how I can fix this?
I'd appreciate any insights!!

Thanks )
Reply With Quote
  #2  
Old 06-16-2009, 03:16 PM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

How about posting your getFileName() procedure complete. Start with Sub and end with End Sub. That is where the selected picture is being displayed.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
  #3  
Old 06-17-2009, 04:32 AM
mamba716 mamba716 is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jun 2009
Posts: 4
mamba716 is on a distinguished road
Default

Code:
Sub getFileName()
' Displays the Office File Open dialog to choose a file name
' for the current employee record. If the user selects a file
' display it in the image control.
   Dim fileName As String
   Dim result As Integer
   With Application.FileDialog(msoFileDialogFilePicker)
      .Title = "Select Panelist Picture"
      .Filters.Add "All Files", "*.*"
      .Filters.Add "JPEGs", "*.jpg"
      .Filters.Add "Bitmaps", "*.bmp"
      .FilterIndex = 3
      .AllowMultiSelect = False
      .InitialFileName = CurrentProject.Path
      result = .Show
      If (result <> 0) Then
         fileName = Trim(.SelectedItems.Item(1))
         Me![ImagePath].Visible = True
         Me![ImagePath].SetFocus
         Me![ImagePath].Text = fileName
         Me![FirstName].SetFocus
         Me![ImagePath].Visible = False
      End If
   End With
End Sub
Reply With Quote
  #4  
Old 06-17-2009, 04:51 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

Have you single stepped the code in the Northwind sample? Put a breakpoint on the With Application.FileDialog(msoFileDialogFilePicker) and F8 through the code and you will se that a lot is happening beyond that procedure. All of that code would need to be included in your db for it to work the same.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
  #5  
Old 06-17-2009, 06:11 AM
mamba716 mamba716 is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jun 2009
Posts: 4
mamba716 is on a distinguished road
Default

I just stepped through the procedure and all looks the same on both. Just to see, I tried adding one of my images to the employee form in the Northwind database and it didn't work.. I think there just might be a problem with my images or the directory they are in... I'm going to investigate...
Reply With Quote
  #6  
Old 06-17-2009, 06:17 AM
mamba716 mamba716 is offline Windows XP Access 2003 (version 11.0)
Novice
 
Join Date: Jun 2009
Posts: 4
mamba716 is on a distinguished road
Default

Turns out there was a problem with my images... I changed the format and now everything works fine. Thanks for your help!
Reply With Quote
  #7  
Old 06-17-2009, 07:13 AM
RuralGuy's Avatar
RuralGuy RuralGuy is online now Windows 7 Access 2007 (version 12.0)
Administrator
 
Join Date: Mar 2007
Location: 8300' in the Colorado Rocky Mountains
Posts: 4,263
RuralGuy will become famous soon enoughRuralGuy will become famous soon enough
Default

Outstanding! Thanks for posting back with your success. Is this thread ready for the "Solved" thread tool?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07
If your issue is resolved...follow this link for directions on how to use the Solved thread tool!
Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus"
Reply With Quote
Reply

Bookmarks

Tags
forms, images, northwind

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filename displaying with image Rob Parker Forms 2 01-13-2010 02:05 PM
Displaying form fields sakthivels Forms 5 05-25-2009 05:52 AM
Displaying records from a form ceb39 Access 5 04-03-2009 10:36 AM
Show a new image per record in a form Bert Colourama Forms 0 09-25-2008 03:22 AM
Displaying a PDF in a Form Chaz Forms 0 08-07-2006 01:26 PM


All times are GMT -8. The time now is 02:49 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.