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

Access image file help!?

Status
Not open for further replies.

twinlizards

Programmer
May 5, 2003
39
US
I have an access database file and am having trouble with the imaga part of it. It is an inhereted program and the image file says "long binary data". Whenever I try to edit or make new image data, whatever the program gives me doen't work. It usually gives me a "package" or "bitmap" or whatever format it allows me. I cannot find or get this to read "long binary data". Do I need to use my VB to do this?
 
prefered method for images: faq181-279 or something similiar once you understand the concept.

I'll assume that this db creator didn't really understand the problems associated with storing long binary formats. You will probably want to stop going down that road of long binary format. You should read the posts on this web site. And read that faq.


Mark P.

Bleh
 
If I use this FAQ181-279 should i make a folder with a path to it with images in there? What would the path look like...
 
the path could be a newtwork path.. \\server\blahblah or a local path c:\yourfoldername.

or something like c:\program files\yourapp\appimages
totally up to you.. any valid path will do.


you can make a folder by mkdir "pathname"

you would save the filename in a field. such as mypicture.jpg, or mypicture.gif

Mark P.

Bleh
 
am i doing this editing in access or vb? it seems like i can get the VB to open up my access database in VB but cannot get the files to show!? Does this help me any....(below) I got this from another source :)

***Building the database***

Before we can construct the ASP code to change and serve the appropriate data we must have a source for the original binary file. To facilitate this we will use a simple database.

The design of the database is simple. We will use a Microsoft Access database with one table ('PacT') and two fields in it: 'Version' (Text) and 'Pac' (OLE Object). (Here 'Pac' is short for 'Package'.) You can obviously add more fields later if your application calls for it.

Next we create a record in the table 'PacT' with an arbitrary value for 'Version' and leave the 'Pac' field empty. This is the point at which we encounter our first problem. That is, how do we get the binary data into the database? There really isn't an easy way. The best way I found is to load up the database in a VB (Visual Basic) program and insert the data in that way. Attached is the source code as well as a compiled executable [1] for the program created to do this. It is very short and simple; however it has not been tested or optimized to a high degree so it might need a little bit of tweaking. The main function of interest is 'Insert Data', and then to confirm that it got in there ok use the 'Write Data To File' function. As a final check when the database is opened again in MS Access for the record of interest the 'Pac' field should say 'Long binary data'. Once this point is reached the database is good to go.

Before we get to the next section, for those of you who are interested on how I arrived at this method, read on. My first approach was not using a database, but rather trying to load up the data into a string and then passing that string on to the client. However as you might imagine when you are dealing with large files this quickly becomes an extremely difficult and tedious task. I am also including the source code [2] to a program that I first created to read a file and then spit out code that would load that file up into a string, byte by byte. Note that I am not including a compiled version at all, since you will have to change some paths and things yourself anyway. It is not nearly as refined as the final program I used to load data into the database, but it actually works (for the most part). If you are distributing a file < 1KB you *might* want to consider using this method under special circumstances, but I would strongly advise against it. The main reason I'm including this source code is because it is interesting; it turns out that it is not very useful.
 
Twin Lizards,

Did you follow the instructions on the FAQ? Do you understand vba? If you want a walk through of how to do every step, i can do that.

The information you posted seems a bit longwinded. The faq I posted is clear consise and works.

Mark P.

Bleh
 
I might need a walkthrough, I inhereted this database and just wanted to add to it for this personal program, but 1 of the columns is an image column that has &quot;long binary data&quot; there. When I load the database to VB I can get the grid but there is no data in the grid, so that's my first problem. But if I can get the image into the database without opening the database in VB then that would be extra! I tried maing a from and posting that info on there but how do I get that form to access database? I opened the database in access and picked insert object and tried adding that from but didn't work, still came up as &quot;package&quot; and not &quot;long binary data&quot;. The program seems to only read this &quot;long binary data&quot; so I would like to get to how to do that :)
 
ooooh,

I see. Your original post said &quot;do I need to use VB to do this.&quot;

Well the answer to that is no.

You can display the file in Access. And if it's already stored in Access, you might just leave it in there.

1. Are there a bunch of images already in the system? If so how many?
2. Were you intending to keep those images, or are they stored elsewhere?
3. Would you mind continueing using Access, or was there some reason you wanted to us VB?
4. I noticed you were looking up something about ASP, was your final intent to get this on a website?

If 4 then, displaying content on a website with long binary wouldn't be a good solution i think. It would be very difficult and db intensive to distribute information that way. In the long run, short run even, it would be more worth it to organize the files in a folder structure that you could save as paths like on the FAQ, then have you asp script pull the image tags from those stored paths.




Mark P.

Bleh
 
Yes I want to display it in access. (1) there are a bunch of image files in this database but the colomn reads &quot;long binary data&quot;. I am interseted in keeping those images and was just adding to the database...ex,349, 350 and so on...I can get the text to show up in the program but when I insert an image file it comes up &quot;package&quot; or &quot;bitmap&quot; or whatever, but not &quot;long binary data&quot; :/ Maybe this will clear up my question, somewhere down the line I got hooked up to my VB and saw the same type of file, OLE and such. When I double click the any image that says &quot;long binary data&quot; it says this: &quot;A problem occured while Microsoft Access was comunicating with the OLE server or Active X control. Close the OLE server and restart it outside of Microsoft Access.&quot;

Now, I can for instance leave the field blank and when I access that field through the program it goes to the folder where my program is and pulls up an image labeled &quot;notfound&quot; so there is a path to this I would think. Can I change or give the new image a path???
 

If you are insistant on using the data the way it is... then...

You should probably insert the image by using the forms. Stop trying to wrestle with the data in the table, its not how you manage ole bound images. Also If there are errors you should probably compact and repair your db.

If you are insisting on using the images in that format, then what you should do is create a new form. Tables are really used more for storing data, whereas forms are used for viewing adding updating deleting and editing data.

Select the table that holds the pictures as the record source. You can from the menu bar select view --> Field list. Add the fields you want to the form (drag and drop them onto the form). The correct control will be added for the image. You should be able to navigate through the records and see the images.

I'm not going to get into how to do the FAQ right now. You need to set up the form. There are a lot of other considerations when using to controls for the same use. It's going to cause a lot more work in the future. So, I would recommend you focuss some time on getting the images out of the binary format and into a folder stucture.




Mark P.

Bleh
 
OK, I am going to keep them in this formats, just because thats how the program reads them. When I create this new form, this is in VB right? That's excately what I wanted to do, just insert new data in to my database. When I do this part: &quot;Select the table that holds the pictures as the record source. You can from the menu bar select view --> Field list. Add the fields you want to the form (drag and drop them onto the form). The correct control will be added for the image. You should be able to navigate through the records and see the images. &quot; This is in the VB or Access? If in VB, is this in the properties of the form?
 
No, the form is not in VB, it is in Access. Do you know how to create a form in Access?

Mark P.

Bleh
 
oh, thats where i was getting confused! I thought, when someone was helping me, I thought they meant VB! wow, that helps alot..sheesh! Let me get back to you in a sec, ok...thx
 
I am not too sure on the Access froms, maybe u can give me a quick run down, looks fairly easy though.
 
Yeah, fool around on it; I'll get back to you tomorrow.

Mark P.

Bleh
 
Okay, I can get the form started but still get &quot;package&quot; or &quot;picture&quot; NOT &quot;long binary data&quot;. I cannot figure what I am doing wrong yet. A sheet I printed for an answer from a previous page told me to load up my database in VB and insert data in that way.It also says the main function of interest is &quot;insert data&quot; and then to confirm that it got in there ok use the &quot;Write Data to File&quot; function. Does that make any sense to you? I am not sure what program to use that will make it easier, it cannot be this difficult, it seems that I am just off a bit. by the way thanx for all your help :)
 
Ok, when I use my VB wizard to open the database that I want and am going through the steps of creating this form, I can see the information listed in my database when I am configuring the wizard. My image file data actually reads &quot;?????Aa??&quot;, so I do see the information, but when complete it shows nothing but the grid and it's headers.
 
when I create my from in access, I can get the form to list everything. when i get the image column all the images have the long binary data, when i access an empty 1 it tells me &quot;embed or link an OLE object into the bound object frame using the object command&quot;. when i use this command, the options it gives me so far do not give me that long binary data, it gives me package or jpeg image or bitmap and so on...now, the &quot;long binary data&quot; field I cannot alter through the &quot;right click&quot; object edit(?) but can edit the object if it's a package or picture of some source. when i do this a rectangular window comes up and this has 2 areas that i can edit this pic or package. there is also a command line that i can put in! does this help?
 
From what I'm seeing here, and in my opinion:
You should not concentrate on the pictures anymore. You should get an access book and learn the basics of access. They will describe the use of ole bound objects.

I would like to help you out, but the fundamentals of access are well, fundamental. Its not that big of a deal really, in about a week you should be at the level where you can approach pictures and not be jumping from access to vb to table to wherever.

If you really want me to continue, I can. But from what I see we've made no progress, you have to read the help files. Have you? Have you checked the FAQs on this site? the Access Developer Handbook is a good resource.






Mark P.

Bleh
 
yes i have used the help file but this doen't tell me how to get the image file to &quot;long binary data&quot;. I have tried using the &quot;object&quot; task but the files it stored them have not givin me the answer I need. The program only seems to read this &quot;long binary data&quot;, when I put others in it just says error. when I leave it blank it goes to a file named &quot;notfound&quot; so there is a path of sorts. The only reason I went to VB is some of the things I was reading made it sound like it was easier to input and access data for the database through VB. One certain answer gave me &quot;Insert Data&quot; and &quot;Write Data To File&quot; functions that I could not find in VB. Also in VB I was unable to see the data once I loaded in my access database. It had all the lists and what the lists were called but no info. I could really use your help, and am going to get an access book. I have a VB for dummies but is not clear on how to get data to show on database file that is uploaded to VB. For some unknown reason, I can get any file to this database &quot;BUT&quot; long binary data?!?! I even tried saving my images in photoshop under EPS where it has binary data but that didn't even work. I tried the paste special but no. Is there something I could write in on a command line or something. One more question: Can I do what I want all in the Access program?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top