Hey
1. I would like to insert pictures in attachments with hotkey. Is it possible?
2. How many photos can I add to attachments?
3. Is it possible to display the pictures after moving the mouse over the attachment? (under the cursor)
Hey
1. I would like to insert pictures in attachments with hotkey. Is it possible?
2. How many photos can I add to attachments?
3. Is it possible to display the pictures after moving the mouse over the attachment? (under the cursor)
1. It is possible but complicated. https://sourcedaddy.com/ms-access/wo...nt-fields.html
Embedding files in table uses up Access 2GB size limit. Usually better to leave files external and save path to file into a text field.
2. As many as Access file size limit will allow.
3. Perhaps with event code in a form.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I am beginner in acces.
I want to upload photos to the database, I have a lot of them (10k +) in the files on the disk or in the excel file thrown there for comments as a background.
How to take a database of such pictures as soon as possible, and how could you tell me what form you could do?
`` 1 Usually better to leave files external and save path to file into a text field. ''
Could you tell me how to do this as soon as possible to upload thousands of photos?
`` 3. Perhaps with event code in a form. ''
Do you have the code?
there are so many ways this might be organised but assuming`` 1 Usually better to leave files external and save path to file into a text field. ''
Could you tell me how to do this as soon as possible to upload thousands of photos?
a) all your pictures are in one folder
b) you have a single table
the code is very simple
a) I'll call the table tblPhotos and it has a single text field called photoPath
b) in a new module have the following code
c) in the immediate window type ?getPhotosCode:Option Compare Database Option Explicit Function getPhotos() dim s as string dim path as string dim sql as string path="C:\myPhotos\" 'change name to the path where you store the photos, don't forget the last backslash s=dir(path) while s<>"" if len(path & s)>254 then msgbox s & " - this file name is too long and won't be imported else sql="INSERT INTO tblPhotos (photoPath) Values('" & path & s & "')" debug.print sql currentdb.execute sql end if s=dir wend end Function
your table will be populated with all the file names, regardless of type (so will include word/excel files etc if they are in the same folder). May take some time depending on how many photos
d) now create a multiple items form (on the ribbon Create>more forms) based on the table
e) in design view add an image control and set its controlsource to photoPath
f) run the form and you should see all the images in a list
note the text field (photoPath) has a maximum of 255 characters so make sure the length of your folder+file name is less than this amount otherwise it won't be imported
``e) in design view add an image control and set its controlsource to photoPath
f) run the form and you should see all the images in a list``
how to do it exactly?
how to set its control source to PhotoPath??
if you can't see the property sheet, open it by clicking the property sheet button on the ribbon. Controlsource is the top property under the data tab
I did everything but it doesn't work
c) in the immediate window type ?getPhotos
i dont understand this point
what does 'doesn't work' mean? you get an error? no errors but files not loaded? but something else
if you don't know what this means, then the code will not have runc) in the immediate window type ?getPhotos
i dont understand this point
If the immediate window is not open then in the vba window, click on View>immediate window
you are not choosing a file, you are choosing a folder
suggest copy and paste the code you are actually using
Option Compare Database
Option Compare Database
Option Explicit
Function getPhotos()
Dim s As String
Dim path As String
Dim sql As String
path = "C:\Users\kqali\Desktop\Nowy folder\media"
s = Dir(path)
While s <> ""
If Len(path & s) > 254 Then
MsgBox s & " - this file name is too long and won't be imported"
Else
sql = "INSERT INTO tblPhotos (photoPath) Values('" & path & s & "')"
Debug.Print sql
CurrentDb.Execute sql
End If
s = Dir
Wend
End Function
and in immediate :
?getPhotos
when i do this ``open the form in design view - see the image control on the ribbon - drag it onto the form in the detail section`` i must choose file in my disc
you have option compare database twice - remove one of them
I provided
[CODE]path="C:\myPhotos\" 'change name to the path where you store the photos, don't forget the last backslash[/CODE]
you have put
path = "C:\Users\kqali\Desktop\Nowy folder\media"
you have not followed my instructions - now highlighted in red.
You may have done, but it has been lost because you have not used the code tags. Please get in the habit of using them (very easy once you have pasted your code, highlight it and click the # button)
The code I provided works based on the very limited information provided - so the implication is your folder only contains one file (sub folders are ignored)
now look like thisL:
Option Compare Database
Option Compare Database
Option Explicit
Function getPhotos()
Dim s As String
Dim path As String
Dim sql As String
path = "C:\Users\kqali\Desktop\media" / code
s = Dir(path)
While s <> ""
If Len(path & s) > 254 Then
MsgBox s & " - this file name is too long and won't be imported"
Else
sql = "INSERT INTO tblPhotos (photoPath) Values('" & path & s & "')"
Debug.Print sql
CurrentDb.Execute sql
End If
s = Dir
Wend
End Function
but I still insert only one photo, there are several photos in the folder
Maybe i will give you team viewer and share , and will you help me?