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].
On 24 Jan 2006 14:14:42 -0800, "FA" <(E-Mail Removed)> wrote:
>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
>
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
|