In form folder creating and picture adding

guestbb

Registered User.
Local time
Yesterday, 16:41
Joined
Jul 14, 2015
Messages
44
Hey everyone, I am new to VBA and need some help.
I have a form where data about bikes is added. The fields are Manufacturer, Model, EngineType. Also in this form there are two field, each for adding the path for a picture. Pictures are mandatory for every entry in the database.
I dont want Attachments because they make database very large very fast. So I decided to go with saving paths to the picture in a textbox field.

To explain where this database is going to be. It will be saved on a Onedrive, and used on multiple PCs. This is the reason why code gets a little complicated (at least for me).

The textbox fields have a Browse and Add button. With the Browse button I fill the textbox for each picture with a link (example C:\\John\Desktop\Noname1.jpg).
The Add button is where the code is complicated.
Here is what I need it to do.
1. When you click the Add button, the code collects the data from the Manufacturer, Model, EngineType fields and creates a path (in memory) and check if the path already exists. The path should be \Picture Base\Manufacturer\Model EngineType\. And the Picture Base folder is in the same place as is the database. (This is handy for currentProject.path)
2. If the path does not exist it creates it as above.
3. Code copies the picture using the path in the field for the first picture (C:\\John\Desktop\Noname1.jpg) and puts the picture in the created folder but under a new name (Model EngineType - ID (picture number 1 or 2).jpg), where the extension remains the same.
4. After it copied the picture I want the new path to be copied to the same textbox field where it got the path for the picture. But here is the catch! I dont want the link to be like C:\\User.... What I want is that the link looks like \Picture Base\Yamaha\R1 Petrol\R1 Petrol - 141 (1).jpg
Because the database is used on different computers and with different users if there is C:\\ it will not work when I use the link to display a picture in a different form.
What I want is to use currentProject.path and this path to display the picture.

5. Also I have another textbox where I would like to store just the path to the folder so that I could put the button for opening the folder. example just \Picture Base\Yamaha\R1 Petrol\ and then also use currentProject.path and this path to open the folder.

If there is anyone that has the time to help me I would be very thankful because I just started VBA.
 
And where is it exactly you have problems?
The members here will assist you with an exactly problem, but writes all the code for you, I do not think they will!
 

Users who are viewing this thread

Back
Top Bottom