Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images in Access? 1

Status
Not open for further replies.

Entrepenueress

Technical User
Aug 12, 2002
16
US
I am trying to create a simple database to serve as a directory for a group of people. Basically, I just want to print the reports and hand them out periodically to each member of this group. I need to have their pictures show up on the report next to their name, but have never known Access to hold image information. Is this possible? If not, what is the best alternative software I should use?
Thank you!
 
I answered a similar question with specific code in the following link:

Thread702-289543

This explaination was for a report but I also added a form object explaination at the bottom.

Hope this helps you.
Bob Scriver
 
This was increadibly helpful! Thank you! Others had tried to explain this but their instructions weren't quite as detailed. Now all I need is to make a BROWSE button in the form that will put the filepath in for them. Do you have an explanation for this? Thank you again!
 
Copy and paste the following into a new module

Option Compare Database

'************** Code Start **************
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = ""
End If
End Function

'*********** Code End *****************


Then put the following into the OnClick property of the command button

Dim strFolderName As String
strFolderName = BrowseFolder("What Folder you want to select?")
Me![RootFolder] = strFolderName & "\"

***************************Code end*************


[RootFolder] is the name of the field that holds the path

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
OK, I do all that and it gives me an error that says Ambiguous Name Detected: BrowseFolder and it highlights the words BrowseFolder.
 
OK, it is working! BUT, it only lets the user select folders, it doesn't show what files are in the folder or let them choose an exact file. Can you help me do this? They will need to select an image file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top