pictures to go with the database

You could store the relative path in the table and

You could code it something like :
Code:
Dim AppPath as String

AppPath = C:\Program Files\....

Image path - code something like
Code:
Imagepath = AppPath & Me.Textboxname

Hope this helps

Andy
 
not quite, a yes and no feeling.
It's a nice way of making things easy.

But VB has an object called app with a path property.
this app.path returns the path from which the program works
If you're program works from "c:\program files\myprogram"
app.path returns "c:\program files\myprogram" automatically.
Should you copy/move the program to "E:\mydatabaseprogram\"
app.path returns "E:\mydatabaseprogram\" automatically.

It's the "automtically" part I am interested in. that way I can store the files in the root of the program directory without ever having to insert the path. This way I have a relative path.

So you understand I really really want to know if VBA in Access has a similar object.property, since VBA in Access didn't recognise the app.path objec.property or shoull I conclude from you (almost) circumventing solution, that there just isn't an object.property of command that does just that?

QC
 
Quantum,

Try the following :

Code:
Application.CodeProject.Path
Application.CurrentProject.Path

If you do a search on Google for 'Application.path in VBA' there are some other solutions.

Andy
 
spacepro said:
Quantum,

Try the following :

Code:
Application.CodeProject.Path
Application.CurrentProject.Path

If you do a search on Google for 'Application.path in VBA' there are some other solutions.

Andy

yep that does it :-) thanx!!!!
 
Working with images in a database without bloating it

spacepro said:
Embedding your images is not a good idea, as per The Doc Man's comments.
It would be quite easy to have a specific folder, thats holds the images that could be packaged with the db when you install it in your environment, otherwise you will have problems with your db later on.

I have attached a sample db that shows how the images can change per record.

Open the table tblNames and change the filepaths in the Imagepath Field to two images on your PC (make sure they are Bitmaps - .bmp).
Then open the form frmPersonnel and scroll through to the next record to see the image change.
If you go to add a new record or don't change the filepaths before viewing the form, you will get one of two error messages. Either Can't find file or Invalid Use of Null, this is because the textbox displaying the path is empty.

Hi
I spotted the above and had a go. I'm a beginner to Access so even the simple things tax me a bit. The database seemed pretty straightforward but i couldn't work out how to have a separate picture appear for each record. I understand about how and where to put the paths though. Do i have to paste some code in the code builder? If so i need to know how to adapt it to what i have as i rarely understand all that code and what to take out and what to put it so it is relevent to my database. At the moment i am getting the same picture for every record.

A simplistic explanation would be very helpful cheers.
 
Just simply change the file paths in the the form or the table to images that exist on your pc, and it will show different images.
On the form there is a image control, all the code does is to change the filepath to the recorded path in the table.

If you go into design view on the form and select the image control and select properties, you can see the filepath property.

The code simply changes it to the relevant picture.

Hope this Helps

Andy
 
Junt one thing: how do I get a relative path in there?
I use fixed path now, but I want to be able to copy/move the database
without having to change all (path) entries

is there something like app.path?

Just a little note:
the Access equivalent of VB's App.Path is...

Application.CurrentProject.Path
 
bumped

this thread as it appears to be a similar problem to mine, hope thats okay:rolleyes:

I'm learning fairly steadily with access (thanks in no small part to this forum!). I have made my own database for work use which works fine relating images to specific records - linked of course to keep the DB size down (one image per report).

The problem I'm encountering now is another database; the main DB of my company in fact. It still relates to images/reports though.
The DB is built so that users can embed:( images into a form which then show on a report. Regular 'spring cleaning' removes images which are no longer required, which is followed by compact and repair, which keeps the DB size down.
The problem I have is that I have a particular part of my work which requires many, many, many images as part of the same report. I've tried embedding the images once, only to find the DB seems to max out at 2GB. and fails to display more than 75% of the images.

I have altered a backup copy of this DB in order to change the image on the form from embedded to linked - this has worked okay.

However, when trying to print preview/print the report, the DB slowdown is unbelievable - so much so i'm considering going back to embedding/doing regular compact repair and having to do this particular report in stages.
When previewing the report, a message box is displayed showing info for each pic - this only reaches about 40% of the total number of images before an error message appears (no details, sorry!).

Is this just due to physical/virtual memory on the chosen PC? Or can some nice person on this forum give any help with Access? (2003 BTW).

Sorry for the length of the above - I needed to explain it properly so I could understand it:)

swifty
 

Users who are viewing this thread

Back
Top Bottom