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

VB code for a button?? 1

Status
Not open for further replies.

maca9

Technical User
Apr 3, 2003
34
NZ
Hi

My problem is that i need to store a large amount of images in the database one way or another. Potentially each item from the item table can have an associated image.

I have currently embedding the image as a OLE in the field which is working great but will not be along term solution due to the size.

I can't just link because there are 2 users who replicate they're version to the server (the reps on the road) and they are the ones who input the image.


What am thinking of doing is having a folder on the server which contains all the images. Then having the rep simply add the file name of the image to the field in the DB. Then have a button which opens the predetermined filepath on the server + the filename from the field.

Does this make sense? Any hints on the code for the button.

basically a button which will open a file from a predetermined folder on the server but gets the file name from the field in the current record.

Cheers


 
Take a look at this thread: thread702-289543

The code I posted in this thread applies to reports and forms. You should be able to pick up the technique that I demonstrated and use it in your situation.

Let me know how it works for you.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Thanks. That works fantastic!!!


That works great. I guess I can hard code a folder location into the code and just have the file name being pulled from the table?

Thanks again

Great help!!
 
That sounds like a plan. Thanks for the star. Much appreciated.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
That code is working great.

However as always I want / need more.

Can I do this for several images on the one form?

That way I can scroll though more than one image at a time.

Any help appreciated.

Cheers
 
Sure you could do that. There are many ways to accomplish it. You could have a table of picture paths and fieldnames that are linked to the current record. Such as a one to many relationship. Then populate a list box on the form of the different picture paths and images from the table.

Then the user can click on selection in the listbox and the code could repopulate the picture control.

Good luck with this.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Bob

Thanks for your reply.

I am 90% seeing what your getting at but not quite.



I have a table with picture paths in it. How do i get more than one of those paths to fill a picture on the form in the way you described me before? 5 at a time would be nice.

The only way i know how to get more than one path on the form at one time is by going between continuous forms or not as the format.

I'm sure its not too hard but am showing my lack of experiance I guess.

Thanks in advance



 
Well you could have multiple Picture objects on your form making your form longer. You could have one on each page staring at page 2, 3, 4, 5, 6. And, then have a Next and Previous page buttons that would walk you through the multiple pages. This would require you to have pagebreaks inserted on the form at equal intervals. The images could then be assigned to each of these objects in the OnCurrent event procedure.

Does this make sense to you. If you have more questions get back with me.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
I am considering actually creating these as objects within the database. Then it will be easier to display or manipulate them. There are about 400MB of pictures.

Although taking a while to input them initially is there any problem with having so many files embedded in the database?
 
I don't really know. I suspect that you are only limited by the max size of a database. I have never seen anything relating to the max number of embedded pictures in a file.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top