If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Help with error while trying to Insert Picture from file into Form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-03, 13:54
dbtod dbtod is offline
Registered User
 
Join Date: May 2003
Posts: 2
Question Help with error while trying to Insert Picture from file into Form

Hello,

I'm hoping that someone knows what I'm doing wrong and can help me with this. Thanks in advance.

I'm trying to insert a picture into a form in the exact same way that the Northwind sample database does in the Employees form. So far I've copied the code and made minimal changes in order to get some of the fields to match up to my db, however I'm getting an error that doesn't seem to make sense.

The error is:
Compile Error:
Variable not defined

This error points to the following subroutine and highlights msoFileDialogFilePicker on line 7

Any ideas as to why this works in the Northwind sample db but not mine?

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 Picture"
.Filters.Add "All Files", "*.*"
.Filters.Add "Bitmaps", "*.bmp"
.Filters.Add "JPEGs", "*.jpg"
.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![Name].SetFocus
Me![ImagePath].Visible = False
End If
End With
End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On