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

insert multiple image on single row in ms access database using vba

Status
Not open for further replies.

Sajjad668

Programmer
Mar 23, 2021
1
0
0
PK
thread705-1678760

Hi,

I am using this thread database but I don't know how to import multiple images to multiple columns. Can please help on that. I want to import 300 images daily and show this images as grid like thread database. I am using this code to insert images which is imported images from my computer.

Public Sub LogPictureFilesToDatabase(sFolderPath As String)
Dim sFileName As String
Dim sAccountName As String
sFileName = Dir(sFolderPath & "\", vbDirectory)

Do Until sFileName = ""
Select Case LCase(Right(sFileName, 4))
Case ".jpg", ".gif", ".bmp"
sAccountName = sFolderPath & "\" & sFileName
DoCmd.RunSQL "INSERT INTO tblImg (Img) VALUES (""" & sAccountName & """)"

Case Else
'Ignore other file extentions
End Select
sFileName = Dir 'Get next file
Loop
End Sub

Thanks
Sajjad
 
What are your fields in tblImg? I would expect to see a primary key etc. Your insert statement doesn't include anything other than a path.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top