Images (1 Viewer)

ilanray

Member
Local time
Today, 07:58
Joined
Jan 3, 2023
Messages
129
Hi
I have a form , on the form I have few textbox and I would like to add images that I copy from printscreen or snipping tool and paste it to access.
I don't want to save the image on the database access. I would like the access open paint or word or some other app so it will paste the image to is and save it as embedded ... and when I open the form next time the image will appear on the form. something like when you write an email and copy paste and example to the body of the mail.
I hope I managed to explain myself......

thanks
 
What version of Windows do you have? Win 11 has a "snipping tool" that might be useful for what you want. If you have Win 10, there is a tool called "Snip & Sketch" that might be helpful.

However, there is a pitfall with your stated approach. Is this a one-time capture or something you would do regularly? Because if you do it too often you risk database bloat that would eventually clog up your DB badly enough to be nearly useless due to lack of working space that is consumed by leftover graphics.
 
I am using win10 but i think you missed me question. I don't mind using and tool for capture the screen, this is not the issue.
the issue is how do i copy and paste into an external app something like paint or even a word so it will be embeded.
And as i mention i don;t want to save the image on the database just save a link to external app
 
I can provide general advice, but not specific advice since I am no longer actively involved with MS Access.
Create an "image" directory where you will store all your images (outside of MS Access) that will be accessed by the database.
On the form that you want to display the image, provide a link (in the form) to that image. The post below should provide you with some guidance.
 
I am using win10 but i think you missed me question. I don't mind using and tool for capture the screen, this is not the issue.
the issue is how do i copy and paste into an external app something like paint or even a word so it will be embeded.
And as i mention i don;t want to save the image on the database just save a link to external app
Not sure what you're asking is doable. You said you don't want to save the image and yet also said that you want the image to display again after you closed and reopened the database. If you don't save the image before closing the database, where would it get that image to display it when you open the database again?
 
Put an image control on the form. Then set it's source in vba if it is going to change, else just set it in the control properties.
 
Note that Windows would launch the best app available for the file type of the file you reference. Provide the fully qualified file specification for the file you want to show, and in this case, the "drive letter" path would be easiest (vs. URS pathing, which is sometimes more verbose). So take Steve R.'s advice about where you put the file and the ways to activate that image. The rule will be that whatever file type you use for the image file, if it would launch a utility correctly by double-clicking the file in a file folder, it will probably work OK when you use the file link from Access.
 
I would like to add images that I copy from printscreen or snipping tool and paste it to access.
I don't want to save the image on the database access.
I would like the access open paint or word or some other app so it will paste the image
There are too many contradictions here. It's not clear what you want to do. First you're talking about pasting image in Access, then you say you don't want to save in Access, then you say you want to paste it in Word.

The following code, opens a new word file, and paste an image from clipboard.
You must have a photo in your clipboard. To test, open a web page, right click an image and select "Copy Image", or open a file and copy the image. (You have to copy the image, not the file)

SQL:
Sub TestWord()
    Dim wdApp As Object
    Dim wdDoc As Object

    Set wdApp = CreateObject("Word.Application")
    wdApp.Visible = True
    Set wdDoc = wdApp.Documents.Add

    ' Ensure the document is selected and cursor is at the start'
    wdApp.Selection.WholeStory
    wdApp.Selection.Collapse Direction:=0  ' Move cursor to start of document'

    If IsClipboardFormatAvailable(2) Then
        wdApp.Selection.Paste
        MsgBox "Image pasted successfully from clipboard!"
    Else
        MsgBox "No image found on clipboard."
    End If

    Set wdDoc = Nothing
    Set wdApp = Nothing
End Sub

If it's not what you want, explain clearly and step by step what you want to do.
PS : Since it's a test, I assumed you have Word application. In real situation, you have to add some code to test if actually Word is installed.
 
Last edited:
ok i will try to explain my self better
lets say I have a form in access with few text box. the form is about TASKS. I want to send a "task" to another member in the team. so far it is working great
Now I have an image in my email or just any print screen that I would like to attach the form so the other member will understand better my request. I would like to send this iimage so he will open the form and will see the image.
i don;t want to save the image on my database. I would like to access create a file with task id and save the image on the specific folder.
Since the image is in the clipboard I guess I need to paste to someother app (word, painter etc)
 
ok i will try to explain my self better
lets say I have a form in access with few text box. the form is about TASKS. I want to send a "task" to another member in the team. so far it is working great
Now I have an image in my email or just any print screen that I would like to attach the form so the other member will understand better my request. I would like to send this iimage so he will open the form and will see the image.
i don;t want to save the image on my database. I would like to access create a file with task id and save the image on the specific folder.
Since the image is in the clipboard I guess I need to paste to someother app (word, painter etc)
It's weekend and I'm away from my pc until Monday. So can not give you an exact code.
  1. Add an image control to your form.
  2. Save the image as an external file in a folder on a server where all pcs have read access to that folder.
  3. In On_Open event of your form, check if the user who opens the form is the target user,
    If yes, then set the file you saved as the picture of your control:
    YourImageControl.Picture="Full Path to the file"

I'm suer someone will help with the details.
 
Since the image is in the clipboard I guess I need to paste to someother app (word, painter etc)

Exactly so. Here is why it is so. Your clipboard is a memory data structure inside your computer and is associated with your session (which is comprised of one or more "processes"). Windows has this rule called "process isolation" (or "separation") that says no other process can look into your process's memory. It is private and this privacy is part of the Windows security setup. So the clipboard has to be saved to a file that can be put on a disk somewhere with file access permissions to allow someone else to open it.

You might want to read up on hyperlinks, which allow you to store a name as text but treat it as a link to a file that you want to open. The thing about hyperlinks is that you can store the full name of any kind of file that Windows can open, and when you open a hyperlink, Windows will use something called "file association" to open it with the right utility. If you use an IMAGE control, it has a slot for the name of an image file and when you load the slot correctly, that image will pop up inside the image control.
 

Users who are viewing this thread

Back
Top Bottom