Solved: MS Access Button to Select File and Store

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hi all,

I hope someone can help!

I am using Access 2000. I am running on Vista but the end application will be stored on computers running Windows XP!

I have a form linked to a table full of records, each being an assessment. On the form is a text box, linked to a field in the table for that record. When the user clicks a button I need it to open a browser so they can pick a file which would be relevant documents to that particular record and then have that location stored in the text box.
The user needs to be able to go back to that form later and click on a button or the text box on the form to open the file location.

I also need to be able to do the same thing but to import or link to a picture which is relevant to the record being viewed! That picture, ideally, needs to come up on reports !!

I have searched the net and browsed for what seems an eternity and had no joy ! Nothing seems to work! I am a little rusty on my programming, so baby steps and idiots guides would be appreciated :eek:

Any help would really be appreciated !
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Flanders, welcome to the Forum.
What you want to do takes quite extensive VBA code. I will post my Document Management Database that will have all the VBA code that you need and you can see it working.
Once you are familiar with it I will explain which parts you need.
 

Attachments

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hi there,

Thanks for your help. I am getting errors with the database though. On opening it comes up with compile error of the Time code used ! I skipped past that and tried the get files areas (cmdGetSource_Click) but also get 'compile error - cant find project or library' on the 'Set fs' and 'Msg' code! :(

I am wondering if my installation of access is missing something, as none of the code i have tried works. I get the same messages all the time !!

Jodie
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Just spotted the problem, in the declaration at the top where you have Dim rs As Object etc, fs is there but not AS anything ! What should it be? Object, String.... ? I can then try again :O)

Thanks
 

OBP

Joined
Mar 8, 2005
Messages
19,896
The actual problem is your VBA Library References, the Excel worksheet in the zip file shows you the Library references that need setting.
Use Alt + F11 to open the VBA Editor and then Main Menu>Tools>References, untick the missing references and then use the drop down list to find your equivelent references.
The last reference on the list has the "find a reference" form open showing where to find it, all the others should be in the drop down list.
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hi OBP,

Thats works fine now, thanks :) (I told you I was rusty! lol)
I love that functionality but am not sure how to simplify it for my needs ! I really only want to select a file and have that location entered into a text box on the form. That text box is run from a hyperlink field so I am hoping that when the user clicks on it at a later date when viewing the record- the file will open !!

I also love the picture element in the Get Filed Documents form. I'd like to try and encorporate that so any pictures relevant to the assessment being recorded can also be linked in!

Thanks so much for your help :)
Jodie
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hiya,
Okay, i have it all in now and adjusted for my needs but it is coming up with an error on the me.test bit of the code. Error is data member or method not found. One last bit of help would be appreciated !! I need to sleeeep !!! lol :)
thanks
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Can you tell me which line is highlighted when you get the error.
The way the my database works is to not use Hyperlinks, it just uses plain text fields for both photos and Documents.
For Photos it uses an Image frame and VBA to load in the photo from the full path to where the photo is stored and you can use the same VBA for reports.
The Document version uses the FollowHyperlink method to open documents als using the full path.
There is lots of usefull VBA in that database.
Have you got the Browser working OK?
Do you need to use the File name (File System Object) part of the Code?
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hiya,
its the first instance of me.test in the code! To make it easier i thought i would attach my database for you to look at. its in the assessments section, edit COSHH assessment. There is a button for relevant docs. This opens your Getfile form. I have taken away some bits that werent needed and added a COSHH ref which identifies which documents in the document table are relevant to that particular assessment. There is also a list box which i want to show all the existing docs for that assessment. I still need a way of getting them to open from here though !!

Thanks so much for you help, I really appreciate it :)
Jodie
 

Attachments

OBP

Joined
Mar 8, 2005
Messages
19,896
Jodie, the test in the me.test is the Unbound Object Frame that shows photos in my version.
You have a list box in the roughly the same position but it is not doing the same thing.
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
HALLELUIA !!!! It is now working !! Thank you so so so much for all your help !! I dont know what I would have done without you :)

You are a STAR !!!!

Jodie
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Well done in adapting my form to work with your database, there are lots of posters who would not have been able to do that. (y)
Can I suggest that you may not really need the Select Cossh assessment form?
Users can find going through multiple forms to enter data a bit wearing over time.
You should also have a look a Tabbed Mainforms, which are quicker than Menus.
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hiya,

I have hit a small problem I hope you can help with ! The document is being attached and its location being placed in a textbox. The texbox has hyperlink as a datatype in the table. It was working fine but now all of a sudden the hyperlink wont work! The location is there but when I click on it no location is being registered - as if the text box is empty ! The table is populated as well and if I try to click on the link directly in the table it still wont work ! Not sure what has changed or gone wrong ! I found the code

Private Sub Attachments_Click()
Application.FollowHyperlink (Attachments & "#" & txtLOC & "#")
End Sub

which I put on the on_click event of the text box and it shows that nothing is in the textbox at all, even though there is on screen !!!!

Any ideas? I am tearing my hair out !!

Thanks

:O)
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Change the Document location field txtLOC to type text with afield size of aroung 100 to 150 characters.
You may find that the hyperlinks are not being processed properly, whereas the Text field using the followHyperlink method should.
Which was why I used it. :)
 

Flanders78

Thread Starter
Joined
Apr 9, 2010
Messages
13
Hiya, thanks for that, i had managed to get it working about 20 minutes ago !!! but again, thank you for your help :)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top