Extract OLE object containg images using VBscript - ms-access

An OLE Object column contains images but the image type (jpg/gif/tiff) is unknown. These images need to be extracted from the DB and saved to disk using VBscirpt.

I've done this before in Delphi, the solution was to use the clipboard (somehow the clipboard can determine the type of image). Copy the contents of the field to the clipboard and then save the contents of the clipboard to a file.

OLE objects is bad way of storing images in MS Access. Use OLEToDisk to save your images as pic files.
After that reimport them in nice way. Check AccessImagine for working with images in Access - it does all the hard job.

Here I found an example to take a screenshot with VBScript and paste it to MS Paint. Maybe you can modify it to do what you want?
http://hisudhakar.spaces.live.com/blog/cns!8DDF980C45482279!410.entry?sa=948299040

Related

Creating a CSV file with the Report Generation Toolkit in Labview

I want to create .csv files with the Report Generation Toolkit in Labview.
They must actually be .csv files which can be opened with Notepad or something similar.
Creating a .csv is not that hard, it's just a matter of adding the extension to the file name that's going to be created.
If I create a .csv file this way it opens nicely in excel just the way it should, but if I open it in Notepad it shows all kind of characters and it doesn't even come close to the data I wrote to the file.
I create the files with the Labview code below:
Link to image (can't post image yet because I've got to few points)
I know .csv files can be created with the Write to Spreadsheet VI but I would like to use the Report Generation Toolkit because it's pretty easy to add columns and rows to the file and that is something I really need.
you can use the Robust CSV package on the lavag.org forum to read and write 2D arrays to CSV files.
http://lavag.org/files/file/239-robust-csv/
Calling a file "csv" does not make it a CSV file. I never used the toolkit to generate an Excel file, but I'm assuming it creates an XLS or XLSX file, regardless of what extension you give it, which is why you're seeing gibberish (probably XLS, since it's been around for a while and I believe XLSX is XML, not binary).
I'm not sure what your problem is with the write spreadsheet VI. It has an append input, so I assume you can use that to at least add rows directly to a file, although I can't say I ever tried it. I would prefer handling all the data in memory explicitly, where you can easily use the array functions to add rows or columns to the array and then overwrite the entire file.

MS access: how to embed JPEG images and preview them?

I use Access 2007
I have created an OLE field to store JPEG, so I can easily drag them into DATABASE.
That works. Trouble is: This field does not dispaly the JPEG but the generic JPEG thumb and I need to double click to open the JPEG and preview it.
Is there a way to preview JPEG without having to double click on it ?
regards
Have you considered storing your images entries for your database as 'text', and simply store the path for the image(//pics/mypic.jpg), rather than the image object itself? If your database is on a shared drive, you can create a folder in the same folder as your database to hold your images. When inserting an image, you can have a textbox and simply type the relative path to that image. This will prevent your database from inflating in size. From there, it is just some simple code to display the picture.
After setting your database up to just store the path names of the images, you can follow these easy instructions on how to display these images on forms : Microsoft Knowledge Base
I recently switched a couple of my databases from using OLE's to text fields with the path name of the picture and am really satisfied with it.
You will need to use an Attachment data type to display anything other than bmps. Only bmp images will display in an OLE field (see the Northwind sample database for an example, the Employee form shows bmp images stored in an OLE field).
Alternatively, you can store the path to the image and show it in your form with some VBA. In general, it is best to store paths to images, rather than images, even with databases that have much higher size limits.

How to extract images from Access CommandButton?

I have an Access database that I am working on, and need to extract the images from a few CommandButtons on a Form and save the images as files.
I haven't been able to do this using VBA. Anyone done this before or know how to do this?
I've used some of the Access built-in images, by using a simple graphics program to capture the screen image, then saving it to whatever format you require (eg bmp etc).

How to paste tabular data into an HTML table

I have an HTML table on a webpage and can edit the contents manually. However, it would make my life much easier if I can copy the data from a file to the clipboard and just paste in onto the form. Can BHOs in IE do this? Any pointers will be helpful.
I have a superset of the data in a file and I don't want to type it all into the webpage.
If your file can be saved as a CSV (using Excel or some other program), then you can use a tool such as the one here (or write your own) to convert it to HTML.

Storing PDFs in MS Access Database using Forms

I need to store PDF files in an Access database on a shared drive using a form. I figured out how to do this in tables (using the OLE Object field, then just drag-and-drop) but I would like to do this on a Form that has a Save button. Clicking the save button would store the file (not just a link) in the database. Any ideas on how to do this?
EDIT:
I am using Access 2003, and the DB will be stored on a share drive, so I'm not sure linking to the files will solve the problem.
We have several databases that contain 10's of thousands of documents (pdf, doc, jpg, ...), no problem at all. In Access, we use the following code to upload a binary object to a binary field:
Function LoadFileFromDisk(Bestand, Optional FileName As String = "")
Dim imgByte() As Byte
If FileName = "" Then FileName = strFileName
Open FileName For Binary Lock Read As #1
ReDim imgByte(1 To LOF(1))
Get #1, , imgByte
Close #1
If Not IsEmpty(imgByte) Then Bestand.Value = imgByte
End Function
In this case, Bestand is the field that contains the binary data.
We use MS SQL Server as a backend, but the same should work on an Access backend.
If you used the same concept but upsized to SQL Server- storing PDFs inside of an Image datatype (or varbinary(max)) then you could SEARCH INSIDE THE PDFs using Full Text Search.
I show that Microsoft says you can do this for any file type where you can register an IFILTER product.. and I just was at the Adobe website the other day and say that their Acrobat IFILTER is indeed FREE.
Maybe this will help: ACC2000: Reading, Storing, and Writing Binary Large Objects (BLOBs).
What they do: Read a file in chunks and add it to a blob using a VBA function.
A field of OLE Object, by default would use a Bound Object Frame on the form. Right click on it and you can Insert an object. It comes complete with browsing for the file. Double-click on the field and the actual document will open.
I recommend going with David's advice and link. Unless you have a need to transfer a single file and want all the PDF's included. Size and performance will be an issue.
If security is an issue and the Access file is the only control you have (You are unable to set security on the folder containing all the linked files.), then you would have to embed.