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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBpix Load images 1

Status
Not open for further replies.

macca007

Programmer
May 1, 2004
86
GB
Hi,

I am currently using dbpix to load images to the database (the images are linked not embeded). However the sample database i got from uses a button to load the images to the database and then stores them.

The feature i would like in my database is to look at a certain folder (each folder will have unique name which is the hospital number) if i select the patient's hospital number(combo box), i would like the code to go to the folder (using the path e.g C:\Database\Images\ & txtHosp\ and display the images on the form.

Firstly has any1 worked with dbpix and if so help me out on this or if you haven't used dbpix provide some assistance for me achieving this feature.

Cheers
 
Can't you tweak the code behind the sample database's button to achieve your goal ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
thanks phv for replying,

The code behind the batch load button is this:

Private Sub btnBatchLoad_Click()
On Error GoTo Finish

Dim strFullPath As String
Dim strFolderName As String
Dim i As Integer

' Display a 'Browse for folder' dialog - see 'BrowseForFolder' module
strFolderName = BrowseFolder("Select folder to load images from")

If Not IsEmpty(strFolderName) And Not strFolderName = "" Then
Dim FileList As New Collection ' List of files in folder (to prevent potential recursive calls to Dir)
Dim strFile As String

strFile = Dir(strFolderName + "\" + "*.jpg", vbNormal)
Do While strFile <> ""
FileList.Add strFile
strFile = Dir
Loop

For i = 1 To FileList.Count ' Try to load each file - DBPixMain_ImageModified does the work of updating
strFile = FileList(i)
If Len(strFile) > 1 Then
strFullPath = strFolderName + "\" + strFile
DBPixMain.ImageLoadFile (strFullPath)
DoCmd.GoToRecord , , acNewRec
End If
Next i
End If

Finish:

End Sub

How can i change it so that i specify the location, for example "C:\Database\Images\" & txtHospno. Instead of displaying browse folder.

Cheers
 
Replace this:
strFolderName = BrowseFolder("Select folder to load images from")
By this:
strFolderName = "C:\Database\Images\" & txtHospno

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top