Converting Varchar Hyperlink address from SQL Server to real hyperlink in MS Access

F

FA

I am using the following code to convert my a url address which is in
Varchar in SQL Server DB into hyperlink since my database is on SQL
Server and there is no such field as MS Access 's HyperLink in SQL
Server 2000
My field name is URL1
and in the DoubleClick Event i have =Connect()

The following functions getting the complire error " Invalide use of Me
on both Me.hwnd and Me.URL"
I added the Shell Library into my references but still getting the same
error

Please help what should i do ?


Public Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
Public Sub Connect(strURL As String)
On Error GoTo Connect_Error

Dim StartDoc As Long
If Not IsNull(strURL) Then
StartDoc = ShellExecute(Me.hwnd, "open", Me.URL, _
"", "C:\", SW_SHOWNORMAL)
End If

Exit Sub

Connect_Error:
MsgBox "Error: " & Err & " " & Error
Exit Sub
End Sub
 
J

John Nurick

There are several things wrong with your code, but what you seem to be
trying to do is much more easily done with something like this, where
XXX is the name of the textbox that's displaying the URL:

Private Sub XXX_Double_Click(Cancel As Integer)
Application.FollowHyperlink Me.XXX.Value
End Sub

In the properties sheet, On DoubleClick must be set to [Event
Procedure].
 
F

FA

It works in the textbox, but i want to show them as hot hyperlink (Blue
Color) on reports as well. I dont know how would we go about achieving
that?

Thanks for your reply

Moe
 

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