Is there an input mask that results in c:\ ? I want to force a file name that is entered in a text box by a user to be preceeded by c:\. Thus a file named test.bmp is entered by a user as such but results in c:\test.bmp.
I see I need to elaborate a bit. I have a text box that stores a path to a picture. The format of the input should be
c:\######.bmp with the #'s being the filename that the user inputs. The rest should be the same for each record. Can someone help me construct an input mask for this? Think I hit submit too soon as well
I would not put a full path in the field. You limit your flexibility, and could end up creating a lot of work. You should store just the image name. Then if all the images are in a default directory, the directory path should be stored in a single record in the defaults table. That way you can pick up the database and move it or move the image folder The user then just has to set the new folder path. The image control's bound field should be a concatenated field of the default folder path and the file name. If you use multipe folders I would still seperate the folder path from the file name.
Also I would not want to type in the name. I would provide a file browser to click on the image to add. That way the user can ensure the correct name.
OK, I need some time to experiment. First I simply used c:\ as the default value for the tbox thus saving some typing time. Now I see some better methods. Off to work we go....
MajP,
I like the browser idea. I do not understand the path being stored in a defaults table idea, could you elaborate? As far as the actual file names....the names really are insignificant, it's the image that's important. So the browser idea would be good. I understand storing all images in an image folder but you lost me after that
If you have 2007 this example will be helpful.
In this case I am actually storing the path and file name in the same location, contrary to what I suggested. However, it demonstrates a couple of things.
1) A browse button to pick an image file and associate it to a record
2) A browse button to pick a folder and associate all images to the record
3) A subform on the main form that shows the thumbnails of all images
4) The ability to show the image contained in a thumbnail.
If using an image control Jpg, Gif, BMP are all supported back to Access 97, maybe earlier.
Here is a 2000 version. I am not sure if it will actually run, but all the code is present.
Bottom line I would never require a user to type in a file name. I would provide a file or folder browser to do that. Chance of a mistake is too high.
The code allows the user to either browse to a file and add that image or browse to a folder and add all images. It does that by writing to a child table using an insert query. Example. The user selects "Add from File" and browses to the C drive. Selects A.Jpg using the browse dialog. An insert query then puts the following data into a table.
Nice job! I can now open jpg but jpeg appears not to....try it see what you think. Also, on your version, what is the purpose of 'description', record 1, record 2 etc?
I am running 2007 so it is hard for me to see what does not work in 2000. Obviously it all works fine for me or I would not post it. JPG works but JPEG will not. Try GIF, JPG.
I set this up for demo purposes of a standard relation for a master field to have multiple child images.
The main table (tblParent) had fields
ID
description
(other main table fields)
the child picture table has
picID
folderPath
fileName
parentID (foreign key to main table)
I set the form to show
Main form bound to the main table (tblParents)
Sub form bound to the child table (tblPics) and display all child pictures. Allows the user to choose a pic to display on the main form.
I like your set up as well as the browse suggestion you have. Here's a combination of the recent work to give you an idea of where I'm going. The layout is comfortable but I still need input Somehow I need to adapt DB5 to this, incorporating the browse feature.
MajP
With the most recent sample I sent, I feel like I went in a big circle, still trying to write to TableImageNames so the rest of the app sees the path. I want to replace the assigned image button with the browse button. Is this where code goes (in the on click event)
I did not have an opportunity to try to figure out what you are doing. But it appears that the main table is "Signs". I cannot figure out if a Sign can have multiple images. If that is the case then you need to have a key in your images table
TblImages
imageID (primary key)
imagePath
signID_FK (foreign key to the sign table)
However. It almost appears that you have a many to many relationship, but not sure. It appears that you have a library of images and multiple signs can have that image.
Does a record in the sign table have a single image or multiple images? If it is a single image then you would put that path directly in the sign table and no child table. Then look at my code to browse and insert a path.
hoofit,
Are you still trying to get this to work? By the way, we used .GIF's because we are doing printing and they take up, way less room. We have a table like it looks like you have and have the full path in the table. You can easily seperate the "C:\" into a seperate field on the table and append them together when accessing your image.
Remember when... everything worked and there was a reason for it?
a. I did not have an opportunity to try to figure out what you are doing. But it appears that the main table is "Signs". (Yes that's correct)
b. I cannot =figure out if a Sign can have multiple images. If that is the =case then you need to have a key in your images table.
(Yes, a sign can be many places. A stop sign can be at the corner or next to the bookstore. The signs table looks up which sign is at a particular location
c. Does a record in the sign table have a single image or multiple images? A sign in the sign table has a single image. A stop sign can only be a stop sign. Multiple signs can be at one location however each sign is treated as an individual record.
hth
I will modify the project and repost it
hoof
d. The balance of the tables is;
***many signs can be the same size, the signs table looks up the particular size
***many signs can be on the same type of post and the signs table looks up the various posts
***a road can many different signs, speed, stop, slow etc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.