I apologize if this has been answered, I searched, but didn't really know what keywords to use.
I have a table of students. One field is photo with the type OLE. I have a directory which has all of the photos in it and the photos are named by student ID (which is the primary key field in the table). Is there an easy way to update the table to put the picture file in the photo field without manually adding each one? I have about 600 to do!
Thanks
5 1933
I apologize if this has been answered, I searched, but didn't really know what keywords to use.
I have a table of students. One field is photo with the type OLE. I have a directory which has all of the photos in it and the photos are named by student ID (which is the primary key field in the table). Is there an easy way to update the table to put the picture file in the photo field without manually adding each one? I have about 600 to do!
Thanks
- What, if any, is the relationship between a Student's ID and his/her Photo Image? If a Student's ID is 123456, then is his/her Photo named 123456.jpg?
- If there is a relationship for naming conventions between ID and Photo, is it consistent?
- What is the Name of the Table housing the [Student ID] and [Photo] Fields?
- What is the Name and Data Type of the [Student ID] Field in the Table?
- What is the Name and Data Type of the [Photo] Field in the Table?
- What, if any, is the relationship between a Student's ID and his/her Photo Image? If a Student's ID is 123456, then is his/her Photo named 123456.jpg?
- If there is a relationship for naming conventions between ID and Photo, is it consistent?
- What is the Name of the Table housing the [Student ID] and [Photo] Fields?
- What is the Name and Data Type of the [Student ID] Field in the Table?
- What is the Name and Data Type of the [Photo] Field in the Table?
All student IDs are seven digit and the photo is named using the studentID.jpg (e.g. 1234567.jpg)
The table housing the student ID and photo fields is tblStudent.
The field name of the student id is StudentStateID and is a text field
The field name of the photo field is photo and is an ole object
All student IDs are seven digit and the photo is named using the studentID.jpg (e.g. 1234567.jpg)
The table housing the student ID and photo fields is tblStudent.
The field name of the student id is StudentStateID and is a text field
The field name of the photo field is photo and is an ole object
Will get back to you on this one.
All student IDs are seven digit and the photo is named using the studentID.jpg (e.g. 1234567.jpg)
The table housing the student ID and photo fields is tblStudent.
The field name of the student id is StudentStateID and is a text field
The field name of the photo field is photo and is an ole object
I think I have a better idea, one which you'll like. Why not store the Photos as Hyperlinks in tblStudent? - Change the [Photo] Field from OLE Object to Hyperlink.
- Execute the code segment below, assuming your *.jpg Naming Convention is consistent as you previously indicated, all 600 Records will be updated with the appropriate Photo for each Student.
-
'Must 1st set a Reference to the Microsoft Scripting Runtime
-
-
'Accessing Folder Properties
-
Dim fso As FileSystemObject
-
Dim fldr As Folder
-
Dim fil As File
-
Dim strSQL As String
-
-
Set fso = New Scripting.FileSystemObject
-
-
'Creates an Instance of a Folder, replace with your own Folder
-
Set fldr = fso.GetFolder("C:\Test\")
-
-
For Each fil In fldr.Files
-
strSQL = "Update tblStudent Set tblStudent.[Photo] = '" & fil.Path & "#" & fil.Path & _
-
"' Where [StudentStateID] = '" & Left$(fil.Name, InStr(fil.Name, ".") - 1) & "';"
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL strSQL
-
DoCmd.SetWarnings True
-
Next
I think I have a better idea, one which you'll like. Why not store the Photos as Hyperlinks in tblStudent?- Change the [Photo] Field from OLE Object to Hyperlink.
- Execute the code segment below, assuming your *.jpg Naming Convention is consistent as you previously indicated, all 600 Records will be updated with the appropriate Photo for each Student.
-
'Must 1st set a Reference to the Microsoft Scripting Runtime
-
-
'Accessing Folder Properties
-
Dim fso As FileSystemObject
-
Dim fldr As Folder
-
Dim fil As File
-
Dim strSQL As String
-
-
Set fso = New Scripting.FileSystemObject
-
-
'Creates an Instance of a Folder, replace with your own Folder
-
Set fldr = fso.GetFolder("C:\Test\")
-
-
For Each fil In fldr.Files
-
strSQL = "Update tblStudent Set tblStudent.[Photo] = '" & fil.Path & "#" & fil.Path & _
-
"' Where [StudentStateID] = '" & Left$(fil.Name, InStr(fil.Name, ".") - 1) & "';"
-
DoCmd.SetWarnings False
-
DoCmd.RunSQL strSQL
-
DoCmd.SetWarnings True
-
Next
Okay, thanks. I will give it a try!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ralph Freshour |
last post by:
I'm trying to code the ability for my users to upload up to photo's to
mysql database - can someone point me in the right direction as to how
this might be done in php? Perhaps a tutorial or some...
|
by: Dirk Goossens |
last post by:
Hi!
I stored the file name and path of photos in a table with data from students
and teachers.
Is there a way to show the photos in a report or form?
Thanks!
Dirk Goossens
Vrij Instituut...
|
by: Ross |
last post by:
Hi
I have an application using asp.net that I am running on my PC.
The web form has a text box where you can enter a name for a new Photo
category then click on the button.
The code is...
|
by: Eric Lindsay |
last post by:
I would like to do a photo gallery with a liquid layout.
I wanted to center a caption below each photo (or above each photo).
I can do that easily with tables, but then I don't have a liquid...
|
by: gm |
last post by:
Hi;
I have written a database that tracks all the installation we have ever
done. I have a small heating company.
I have recently started keeping a directory of digital photographs of the...
|
by: el_espasmo |
last post by:
Yes... I know the question might be stupid but... I still want to try because I haven't been able to solve this.
I have been trying to change some stuff in MySpace, but not in my profile, in...
|
by: el_espasmo |
last post by:
Yes... I know the question might be stupid but... I still want to try because I haven't been able to solve this.
I have been trying to change some stuff in MySpace, but not in my profile, in...
|
by: K. |
last post by:
Hello all!
I have a question to you.
I would like to create photo gallery.
I wonder if I should store photos (uploaded by users) in database
$data = file_get_contents($_FILES);
$data =...
|
by: cumupkid |
last post by:
II am trying to create a form that will allow me to upload photos to a folder in the site root directory and add the information to the mysql db at the same time.
I have created two forms, one...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |