Creating & using Hyperlinks

P

Paul

I have created a database using Access 2003: The DB has multipul table, one
of which contains all personal information regarding a single investigation,,
Name, Addreess etc. I have included one field to contain a hyperlink address:
the address will always start the same: e.g K:\Investigations\Live\Photos\ENF
????.
The question marks are an incrimental number. I am using Autonumber to
generate the case file number - this is then used when creating a Folder in
my K: directory (as above).
When creating a new case, i require the Photo field to auto populate with
the creating the correct unique hyperlink address relating to the correct
file.
I will therefore put a comand button on screen to retrieve or link to the
file and therefore allow viewing of photos etc
Can you help :


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...9d1c&dg=microsoft.public.access.modulesdaovba
 
D

Dale Fye

Check out the Application.FollowHyperlink method in help. You can use this
in the click event of your command button, append the default file path, and
get the file name from the ID field of your table.

HTH
Dale
 
D

Database Whiz Consulting

Hey Paul. Is there just the single photo file in the directory you create or
many? I would assume many.

We do something similar to what you're doing with a client of ours that
wants a paperless office. Rather than storing all of the photo information in
the database, we already know that the files for any particular investigation
are going to be in K:\Investigations\Live\Photos\ENF\XXXX where XXXX =
InvestigationID.

In this case, we simply use a list box to show the file contents of the
folder for the current investigation. All the user has to do is double-click
the file in the listbox they wish to see...or click on the file and then
click an Open File button.

In the sub below, openfile.bat simply has %1 in it, which will be the file
name you send it. Windows will use the default program to open the file,
whatever file type it is.

Private Sub cmdOpenFile_Click()
Dim ret As Integer
Dim strFile As String

On Error Resume Next

If IsNull(Me.FileList) Then
MsgBox "You did not select a file to open.", vbInformation, "No File
Selected"
Exit Sub
End If

strFile = "K:\Investigations\Live\Photos\ENF\" & Me.InvestigationID &
"\" & Me.FileList

'MsgBox Application.CodeProject.Path & "\openfile.bat " & strFile
ret = Shell("""" & Application.CodeProject.Path & "\openfile.bat"" """ &
strFile & """", vbHide)
Exit Sub

ErrorTrap:
MsgBox "Error #" & Err.Number & ": " & Err.Description, vbInformation,
"Error"

End Sub


Let me know if this helps you at all or if u need help populating the
listbox with the folder's file contents.


Ray Jefferson
Database Whiz Consulting
www.databasewhiz.com
 
P

Paul

Hi Ray

I thank you for your response and suggestion:
Following posting my request fro help, I was working on another part of the
program and it suddenly came to me:

See below:

If Trim(Me.[CustomerID] & "") <> "" Then
FollowHyperlink "K:\Enforcement\Investigated_Cases\ENF " & Me.[CustomerID]
Else

Very short and direct: It works perfectly:
I have one other query though and that is:

Using a main menu screen with a pop up Customer information screen (full
size), i then use various on screen buttons to pop up sized information
screens: the problem i am having is that if i click on the background screen,
the popup disappears but is running underneath the main screen.
I therefore require to lock to the opup up until it is closed..... Cant work
this one out:
the only thing that i can think of is to create a multi macro which closes
all popup screens and re-initialises the main form:
This again is working perfectly however I think there maybe a cleaner way of
doing this.... Any Ideas.

Thanks

Paul
 
D

Database Whiz Consulting

Are all of the pop up screens directly related to the Customer information on
the main screen that is open? If so, I would simply use a tab control rather
than using the pop up screens. Not in any of our applications would we have
multiple pop-up windows on screen at the same time, so I may not be
envisioning what you're doing exactly. Let me know if tab control is the way
to go though.

RJ


Paul said:
Hi Ray

I thank you for your response and suggestion:
Following posting my request fro help, I was working on another part of the
program and it suddenly came to me:

See below:

If Trim(Me.[CustomerID] & "") <> "" Then
FollowHyperlink "K:\Enforcement\Investigated_Cases\ENF " & Me.[CustomerID]
Else

Very short and direct: It works perfectly:
I have one other query though and that is:

Using a main menu screen with a pop up Customer information screen (full
size), i then use various on screen buttons to pop up sized information
screens: the problem i am having is that if i click on the background screen,
the popup disappears but is running underneath the main screen.
I therefore require to lock to the opup up until it is closed..... Cant work
this one out:
the only thing that i can think of is to create a multi macro which closes
all popup screens and re-initialises the main form:
This again is working perfectly however I think there maybe a cleaner way of
doing this.... Any Ideas.

Thanks

Paul


Database Whiz Consulting said:
Hey Paul. Is there just the single photo file in the directory you create or
many? I would assume many.

We do something similar to what you're doing with a client of ours that
wants a paperless office. Rather than storing all of the photo information in
the database, we already know that the files for any particular investigation
are going to be in K:\Investigations\Live\Photos\ENF\XXXX where XXXX =
InvestigationID.

In this case, we simply use a list box to show the file contents of the
folder for the current investigation. All the user has to do is double-click
the file in the listbox they wish to see...or click on the file and then
click an Open File button.

In the sub below, openfile.bat simply has %1 in it, which will be the file
name you send it. Windows will use the default program to open the file,
whatever file type it is.

Private Sub cmdOpenFile_Click()
Dim ret As Integer
Dim strFile As String

On Error Resume Next

If IsNull(Me.FileList) Then
MsgBox "You did not select a file to open.", vbInformation, "No File
Selected"
Exit Sub
End If

strFile = "K:\Investigations\Live\Photos\ENF\" & Me.InvestigationID &
"\" & Me.FileList

'MsgBox Application.CodeProject.Path & "\openfile.bat " & strFile
ret = Shell("""" & Application.CodeProject.Path & "\openfile.bat"" """ &
strFile & """", vbHide)
Exit Sub

ErrorTrap:
MsgBox "Error #" & Err.Number & ": " & Err.Description, vbInformation,
"Error"

End Sub


Let me know if this helps you at all or if u need help populating the
listbox with the folder's file contents.


Ray Jefferson
Database Whiz Consulting
www.databasewhiz.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top