building connection string

J

Jerry Anderson

I'm trying to open a specific Word document titled ""P:\City Clerk - Award of
Bid\Bid Award with Budget Amendment and Future Year Committments and
Committee Approval". (I didn't name it!!) Based on the values of three check
boxes, I have built the following code. It doesn't work. Why?
Dim strDoc As String
strDoc = "P:\City Clerk - Award of Bid\Bid Award"
If Me.BidCheck1 = True Then
strDoc = strDoc & " with Budget Amendment"
Else
strDoc = strDoc & " without Budget Amendment"
If Me.BidCheck2 = True Then
strDoc = strDoc & " and Future Year Committments"
Else
strDoc = strDoc & " and No Future Year Committments"
If Me.BidCheck3 = True Then
strDoc = strDoc & " with Committee Approval"
Else
strDoc = strDoc & " without Committee Approval"
End If
End If
End If
Application.FollowHyperlink strDoc
 
D

Douglas J. Steele

You're not putting the ".doc" extension at the end. Even if you're not
displaying the file extensions, they need to be there, or else Windows has
no way of knowing what the file is, or what application to use to open it.
 
J

Jerry Anderson

Thanks; I added it. Now when I try to run it, I get an error message that
says "Object doesn't support this property or method".
 
D

Douglas J. Steele

What's actually in strDoc? Before the Application.FollowHyperlink strDoc
line, add

Debug.Print strDoc

When the code fails, go to the Immediate Window (Ctrl-G) and check what's
written there.
 
Top