![]() |
|
|
#1
|
|||
|
|||
|
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 )
|
|
#2
|
||||
|
||||
|
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" |
|
#3
|
|||
|
|||
|
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
|
|
#4
|
||||
|
||||
|
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" |
|
#5
|
|||
|
|||
|
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...
|
|
#6
|
|||
|
|||
|
Turns out there was a problem with my images... I changed the format and now everything works fine. Thanks for your help!
|
|
#7
|
||||
|
||||
|
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" |
|
| Bookmarks |
| Tags |
| forms, images, northwind |
| Thread Tools | |
| Display Modes | |
|
|
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 |