Open Document Using Combo on AfterUpdate

  • Thread starter Thread starter mikeowen
  • Start date Start date
M

mikeowen

Guest
Hope some one can help.
I'm trying to open a JPEG image from with in Access by using a combo box with the file name in .
The documents are scanned in and each document has a bar code with a unique number.
The bar code number is scanned into a data base field and the image file is given the same name.
The idea was to then use the combo box to select the file and use code on the AfterUpdate function.
Needless to say I can not get this to work.
In frustration I have plucked halve of one of my eyebrows away and did not even notice.
Happy New Year to you all

Mike
 
Mike, I use the following code to configure and open a hyperlink to a user selected Word document:

Private Sub List60_DblClick(Cancel As Integer)
Dim jprvar, mx1 As String, tx1 As String, resp As Variant
mx1 = "Can't find JPR# " & Me!List60.Column(1)
Me![Text56] = makelink(Me!List60.Column(1))
If Dir(Me!Text56) = "" Then
resp = MsgBox(mx1, vbOKOnly)
GoTo out
End If
Dim ctl As CommandButton, i As Integer
Set ctl = Me!Command44
With ctl
If IsNull(Me!Text56) = False Then
.HyperlinkAddress = Me!Text56
End If
If .HyperlinkAddress = "" Then
GoTo out
End If
.Hyperlink.Follow True
End With
out:
End Sub

Here is the "makelink function called above. It is probably more involved than you need due to my multilingual document option requirement.

Function makelink(strjpr As String) As String
'Create a hyperlink address to a JPR document. Allow user to select English
'or Spanish version if both are available.
Dim sel As String * 1, msgx As String, tx As String, pathe As String, paths As String
tx = "JPR Data System"
msgx = "The JPR you have selected to open is available" & Chr(10) _
& "English and Spanish. Which one do you want to open?" & Chr(10) _
& "Enter 'E','e' (ENGLISH) - 'S','s' (Spanish):"
pathe = makedocpath(strjpr, 1)
If testpath(pathe) = False Then
makelink = ""
GoTo out
End If
paths = makedocpath(strjpr, 2)
If testpath(paths) = True Then
sel = InputBox(msgx, tx, "E")
If UCase(sel) = "S" Then
makelink = paths
GoTo out
ElseIf UCase(sel) = "E" Then makelink = pathe
Else
makelink = ""
End If
Else
makelink = pathe
End If
out:
End Function


Good Luck! Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom