Automatically populating a WWW location by using a navigation pop-up?

Tambo

New member
Local time
Today, 10:13
Joined
Mar 12, 2009
Messages
6
Automatically populating a text box with file location by using a navigation pop-up?

Hi there,

I'm in the process of creating a document database (and this website has been invaluable) that will allow end-users the ablity to search for particular types of in-house research, along with the ability to store their completed documents on the database and allow others across the company to view them.

I'd originally designed it with OLE embedding (so that the end user could just drag and drop their document onto an "add new record" form), but I encountered the inevitable bloat after a few test documents.

So... I've decided to keep all the documents in a central network folder and I'll have end-users store their documents in this folder and simply enter a link to them in a text box (bound to a "WWW Location" field) on the "add new record" form.

However, is it possible to populate the WWW Location text box by 'browsing' to the location somehow? Perhaps by having a button next to the text box that pops up a navigation box... and when you selct which file you want to link to, it automatically populates the aforementioned text box?

Is this possible?

I've tried searching but I've got a feeling that I'm not using the right search criteria.
 
Last edited:
By bound to a "WWW Location" do you mean a document on a web site? I am not sure it Access has the ability to browse web site.

I would urge to to look into using Microsoft's Sharepoint. AFAIK, it is designed to handle what you want.
 
Since you say "central network folder" I assume you only need to implement a browse button, that will return the full path including the file name of the document that the user 'browses' to.

I have been using a module that uses Windows/Office API calls to enable a whole bunch of different file and folder browsing options. Try this link.
http://www.mvps.org/access/api/api0001.htm

You basically save the code into a new module, then call the function from a button on your form to populate the textbox eg me.txtFilePath = BrowseToFile(options...)

The other option is to add the MS Common Dialog Control activeX to your solution, but as a general rule I hate adding extra references unless there is no other option.
 
By bound to a "WWW Location" do you mean a document on a web site? I am not sure it Access has the ability to browse web site.

I would urge to to look into using Microsoft's Sharepoint. AFAIK, it is designed to handle what you want.
Sorry, no. My mistake. "WWW Location" was just the default field name that Access assigned to it. I'm talking about linking to documents on a network location.

Sharepoint is nice, but I don't work in the IT department so... ahem... my opinion is invalid! :D
Since you say "central network folder" I assume you only need to implement a browse button, that will return the full path including the file name of the document that the user 'browses' to.

I have been using a module that uses Windows/Office API calls to enable a whole bunch of different file and folder browsing options. Try this link.
http://www.mvps.org/access/api/api0001.htm

You basically save the code into a new module, then call the function from a button on your form to populate the textbox eg me.txtFilePath = BrowseToFile(options...)

The other option is to add the MS Common Dialog Control activeX to your solution, but as a general rule I hate adding extra references unless there is no other option.
Bingo! This is sounding promising. I think you've managed to read through my garbled post and determine what I'm looking for!

I'll give this a go later today and feed back. I'm using Access 2003, I take it the code will still work?
 
Try this link.
http://www.mvps.org/access/api/api0001.htm

You basically save the code into a new module, then call the function from a button on your form to populate the textbox eg me.txtFilePath = BrowseToFile(options...)
Is there any chance you (or anyone else) can elaborate on that bit above?

I'm relatively new to modules and coding but I generally pick things up quickly with a few pointers. I've copied the code into a module and have six bound text boxes with buttons next to them (see "add record form").

attachmentr.jpg


Not quite sure how to programme each of the buttons to populate the respective text boxes with the network address I would browse to.

I've uploaded an anonymised example of the database I'm creating (minus corporate logos and such) so you can see what I'm thinking.

Thanks for taking an interest. 'Tis much appreciated.
 

Attachments

Last edited:
First things I see is the you have not properly normalized your data. You have repeating fields. Each document should be a separate record in a child table/

I have also found the the hyperlink data type is ONLY good for web site address. I would urge you to use just a text data type.

I'm a looking for am example for you. I will post it as soon as I find it.
 
Tambo,

After looking at the database you attached, you are basically there, all you need to do is add the code to the buttons on your new record form. For example:

Code:
Me.Text55 = GetOpenFile(Me.Text55)

This calls the GetOpenFile function in the module you have created, which opens the dialog box for browsing.

One thing to note about the module code is that the filter is already set to Access database files, so you may want to change that to something like Word docs.

Have a look in the module for the code:

Code:
    strFilter = ahtAddFilterItem(strFilter, _
                "Access (*.mdb)", "*.MDB;*.MDA")

and replace it with something more meaningful for your database

Code:
    strFilter = ahtAddFilterItem(strFilter, _
                "Documents", "*.doc;*.pdf")

Also, take a look at HiTecCoach's example, as it implements this code as well.
 
Thanks guys. I really appreciate both of your efforts and being able to provide me with both example code and working samples.

I'm going to have a crack at finishing this off later this week. Will report back with news.
 
Success! :D

(mostly) ;)

I've successfully managed to get a document linking system set up and to have the documents activate when a cell is clicked on the subform. I've done this by stripping the modules out of the DB that HiTechCoach provided, comparing it with the code listed in this thread and, in doing so, managed to make myself a neat little form. Thanks guys! I'm pretty happy with what I've got... but there's just one thing that's niggling me.

When the GetOpenFile function activates and the navigation box opens, it seems to default to My Documents. Worse still, even after shutting down the database and re-opening, the navigation box defaults to the directory location of the last document I linked to. While this isn't the end of the world, it would really help if I could get it to default to a particular directory time after time.

Right at the beginning of the module, it says:
Code:
Option Compare Database

Option Explicit

' the constant strDefaultDir can be set to any directory
' as the default starting directory if onw is not passed
' Can be set to = ""

Global Const strDefaultDir = "C:\"

'This code was originally written by Ken Getz.
Despite altering this default, it doesn't alter the directory that appears when the naviation box is opened (I don't know why it would, given that it originally defaulted at My Documents).

Any ideas on how this can be achieved?
 
If you are using the code by HiTechCoach, then the function GetOpenFile takes an optional parameter that sets the starting folder to browse.

So when you call this function from your form, you could set the starting folder to anything you like;

Code:
strDocPath = GetOpenFile("C:\temp")

If you want to see where this value is used, look for the code below in the modAPIs module:
Code:
    If IsMissing(varDirectory) Then
        varDirectory = ""
        varDirectory = strDefaultDir   ' set to the default
    End If
 

Users who are viewing this thread

Back
Top Bottom