473,699 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to activate hyperlink in text box

24 New Member
Hello,

I have a problem with hyperlink.
I have a text box that contains link to the document. I enter the link by clicking on the button "add link". When I add link, the windows browser opens and i can search for exact document. But when I save the path in the Link text box, the link doent work. It is stored in News table and I changed it for hyperlink but still doesnt work. I noticed that when I am saving the path, it saves me the path as a link name that is shown in the text box, but the hyperlink path is empty.
How to make it works?
I would be grateful for help.


Greets

Greg
Nov 14 '07 #1
15 37890
ADezii
8,834 Recognized Expert Expert
Hello,

I have a problem with hyperlink.
I have a text box that contains link to the document. I enter the link by clicking on the button "add link". When I add link, the windows browser opens and i can search for exact document. But when I save the path in the Link text box, the link doent work. It is stored in News table and I changed it for hyperlink but still doesnt work. I noticed that when I am saving the path, it saves me the path as a link name that is shown in the text box, but the hyperlink path is empty.
How to make it works?
I would be grateful for help.


Greets

Greg
You cannot Add a Hyperlink to a Text Box on a Form, when you attempt this a Label containing the Hyperlink will be added to the Form, and clicking on it will Navigate to the Destination. It obviously will not be Bound or saved to a Table. If a Field in a Table is defined as Hyperlink and Links are added at the Table Level, you can then set the Control Source of a Text Box to this Field and you can activate the Hyperlink in this manner. You can also programmaticall y add a Hyperlink to a Text Box on a Form and Bind it to the underlying Field.
Nov 14 '07 #2
dillneus
24 New Member
You cannot Add a Hyperlink to a Text Box on a Form, when you attempt this a Label containing the Hyperlink will be added to the Form, and clicking on it will Navigate to the Destination. It obviously will not be Bound or saved to a Table. If a Field in a Table is defined as Hyperlink and Links are added at the Table Level, you can then set the Control Source of a Text Box to this Field and you can activate the Hyperlink in this manner. You can also programmaticall y add a Hyperlink to a Text Box on a Form and Bind it to the underlying Field.
thank you for reply. but i think i wasnt too clear.
actually i can store this hyperlink to the table field but then i cannot open hyperlink.

Maybe i will describe it more detailed:

i have News Table where there is a News.Link field (it is set as hyperlink).

then I have News Form where I have text box - Link - which has control soucre News.Link from the News Table.

Under that Link I have button which opens browser and then in the folders on the hard drive I can choose one document. I press save and the whole path is saved on this text box Link, which is bound to News.Link.

But this paths doesnt open a hyperlink, although I set hyperlink options in Form and in Table.

Now I want to be able to open document just by clicking on that text box field in Form. Now I am clicking and nothing happens.

Do you know how to do it?
Nov 14 '07 #3
ADezii
8,834 Recognized Expert Expert
thank you for reply. but i think i wasnt too clear.
actually i can store this hyperlink to the table field but then i cannot open hyperlink.

Maybe i will describe it more detailed:

i have News Table where there is a News.Link field (it is set as hyperlink).

then I have News Form where I have text box - Link - which has control soucre News.Link from the News Table.

Under that Link I have button which opens browser and then in the folders on the hard drive I can choose one document. I press save and the whole path is saved on this text box Link, which is bound to News.Link.

But this paths doesnt open a hyperlink, although I set hyperlink options in Form and in Table.

Now I want to be able to open document just by clicking on that text box field in Form. Now I am clicking and nothing happens.

Do you know how to do it?
I answered a similar Question several weeks ago, referring to this Post should help you. The key point to remember is that a Hyperlink can consist of three Sections delimited by a '#' sign. Specifying only the URL will not work, it will simply be assigned to the Caption.
Inserting a Hyperlink into a Table
Nov 14 '07 #4
dillneus
24 New Member
I answered a similar Question several weeks ago, referring to this Post should help you. The key point to remember is that a Hyperlink can consist of three Sections delimited by a '#' sign. Specifying only the URL will not work, it will simply be assigned to the Caption.
Inserting a Hyperlink into a Table
Thx for link. It sounds like the answer for my question. but i dont know how to put it to my database. I quite begginer so some things i dont understand.

So:
What is this File Dialog: msoFileDialogFi lePicker, msoFileDialogVi ewDetails
Is it module or sth like that?
I have to modules: openSavebrowser and basBrowseFiles for opening the browser and inserting the file path into the text box (but it put only the path in the text display part, not in path part).
Maybe I have wrong module (FileDialogFile Picer??). Do you have maybe codes for that FilesDialogs that are mentioned in the code from that link?

Where shall I insert that code that was in that link you gave me? I have button that is named link2. shall i put in into onclick option in Event Procedures?

greets
Nov 14 '07 #5
ADezii
8,834 Recognized Expert Expert
Thx for link. It sounds like the answer for my question. but i dont know how to put it to my database. I quite begginer so some things i dont understand.

So:
What is this File Dialog: msoFileDialogFi lePicker, msoFileDialogVi ewDetails
Is it module or sth like that?
I have to modules: openSavebrowser and basBrowseFiles for opening the browser and inserting the file path into the text box (but it put only the path in the text display part, not in path part).
Maybe I have wrong module (FileDialogFile Picer??). Do you have maybe codes for that FilesDialogs that are mentioned in the code from that link?

Where shall I insert that code that was in that link you gave me? I have button that is named link2. shall i put in into onclick option in Event Procedures?

greets
The Link that I provided for you also shows sample FileDialog code.
Nov 14 '07 #6
dillneus
24 New Member
The Link that I provided for you also shows sample FileDialog code.
I saw that code but i dont know exactly how to change it...
msoFileDialogFi lePicker, msoFileDialogVi ewDetails - i dont know my equivalent of thos fields...
are there modules codes or sth else???...
I will follow that sample you gave on my example, and if you could check if this is correct i would be greatful:

What is the Field Name? Link

Is this Field defined as a Hyperlink Data Type in the Table? YES

What is the Table's Name? NEWS

What URL are you trying to Update the Field to? (Microsoft.com, Google.com, TheScripts.com, etc.)
I have text box: Link which is bound to [News].[Link] field.


Now what i need is to be able to add paths of files into Link field as a hyperlink path.

So where should i put this code:
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Application.FileDialog(msoFileDialogFilePicker) what should i put into msoFileDialogPicker?? 
  4.  
  5. With .Filters
  6.      .Clear
  7.      .Add "Text Files", "*.txt"
  8.      .Add "Database Files", "*.mdb"
  9.      .Add "All Files", "*.*"
  10.    End With
  11.        'The Show Method returns True if 1 or more files are selected
  12.        .AllowMultiSelect = True
  13.        .FilterIndex = 2     'Database files
  14.        .ButtonName = "Link2"
  15.        .InitialFileName = vbNullString
  16.        .InitialView = msoFileDialogViewDetails' (and what is that FiledDialogViewDetails?? )
  17.  
  18.        .Title = "Find the damn File!"
  19.           If .Show Then
  20.             For Each varItem In .SelectedItems     'There will only be 1
  21.               Me![Link] = varItem
  22.             Next varItem
  23.           End If
  24. End With
I am quite lost with that and i dont know how to proceed further...

greets
Greg
Nov 16 '07 #7
ADezii
8,834 Recognized Expert Expert
I saw that code but i dont know exactly how to change it...
msoFileDialogFi lePicker, msoFileDialogVi ewDetails - i dont know my equivalent of thos fields...
are there modules codes or sth else???...
I will follow that sample you gave on my example, and if you could check if this is correct i would be greatful:

What is the Field Name? Link

Is this Field defined as a Hyperlink Data Type in the Table? YES

What is the Table's Name? NEWS

What URL are you trying to Update the Field to? (Microsoft.com, Google.com, TheScripts.com, etc.)
I have text box: Link which is bound to [News].[Link] field.


Now what i need is to be able to add paths of files into Link field as a hyperlink path.

So where should i put this code:
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Application.FileDialog(msoFileDialogFilePicker) what should i put into msoFileDialogPicker?? 
  4.  
  5. With .Filters
  6.      .Clear
  7.      .Add "Text Files", "*.txt"
  8.      .Add "Database Files", "*.mdb"
  9.      .Add "All Files", "*.*"
  10.    End With
  11.        'The Show Method returns True if 1 or more files are selected
  12.        .AllowMultiSelect = True
  13.        .FilterIndex = 2     'Database files
  14.        .ButtonName = "Link2"
  15.        .InitialFileName = vbNullString
  16.        .InitialView = msoFileDialogViewDetails '(and what is that FiledDialogViewDetails?? )
  17.  
  18.        .Title = "Find the damn File!"
  19.           If .Show Then
  20.             For Each varItem In .SelectedItems     'There will only be 1
  21.               Me![Link] = varItem
  22.             Next varItem
  23.           End If
  24. End With
I am quite lost with that and i dont know how to proceed further...

greets
Greg
Don't have the time right now but I'll give you step-by-step detailed information as soon as I get the chance, hopefully tonight.
Nov 16 '07 #8
dillneus
24 New Member
Don't have the time right now but I'll give you step-by-step detailed information as soon as I get the chance, hopefully tonight.
ok no problem. i will check it tommorow then. thx
Nov 16 '07 #9
ADezii
8,834 Recognized Expert Expert
ok no problem. i will check it tommorow then. thx
The following code, placed in the Click() Event of a Command Button named cmdPopulateHype rlink will:
  1. Open a File Dialog Box, and allow you to select only 1 File of any type.
  2. Allow you to customize the Button and Dialog Title Captions within the File Dialog Box.
  3. Write the Hyperlink Caption and Address (both are required) to the Link Text Box on the Current Form. The Control Source for this Link Text Box is the [Link] Field.
  4. The Record Source for the Form is the Table News.
  5. The code has been thoroughly tested and is fully functional. I inserted Comments where I thought they may be needed.
  6. Any questions, feel free to ask.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdPopulateHyperlink_Click()
  2. 'First, set a Reference to the Microsoft Office XX.X Object Library
  3.  
  4. Dim strButtonCaption As String, strDialogTitle As String
  5. Dim strHyperlinkFile As String
  6.  
  7. 'Define your own Captions if necessary
  8. strButtonCaption = "Save Hyperlink"
  9. strDialogTitle = "Select File to Create Hyperlink to"
  10.  
  11. With Application.FileDialog(msoFileDialogFilePicker)
  12.   With .Filters
  13.     .Clear
  14.     .Add "All Files", "*.*"     'Allow ALL File types
  15.   End With
  16.   'The Show Method returns True if 1 or more files are selected
  17.     .AllowMultiSelect = False       'Critical Line
  18.     .FilterIndex = 1 'Database files
  19.     .ButtonName = strButtonCaption
  20.     .InitialFileName = vbNullString
  21.     .InitialView = msoFileDialogViewDetails     'Detailed View
  22.     .Title = strDialogTitle
  23.   If .Show Then
  24.     For Each varItem In .SelectedItems 'There will only be 1
  25.       'Caption and Address of Hyperlink will be the same (Caption#Address)
  26.       strHyperlinkFile = varItem & "#" & varItem
  27.         Me![Link] = strHyperlinkFile
  28.     Next varItem
  29.   End If
  30. End With
  31. End Sub
  32.  
Nov 16 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7463
by: Tero Partanen | last post by:
Hello! I'm writing about a rather peculiar problem I'm having with Access2000. I have a table in which I have created one hyperlink-type field. I have given the field a default value which is an email-address. The default value is (for example): "mailto:mymail@here.com". Access2000 correctly inserts that information into the field everytime
9
15017
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring = datagrid.Items(rownumber).Cells.Item(column number).Text returns a blank string. It seems to work ok for the other columns that are just regular datagrid columns, not hyperlink types. Thanks. -- Paul G Software engineer.
19
3544
by: Joe | last post by:
I have an aspx page (referred to here as page_1) with a datagrid whose first column contains hyperlinks. When a user clicks one of these hyperlinks, he will navigate to another aspx page (referred to here as page_2). I need to cache the value of the link's text (hyperlink.text property) so that I can use it in the page_load event of page_2. I've thought of using a hidden field and then calling Request.Form("hdnClickedLinkText") in the...
2
2097
by: Keith Wilby | last post by:
I have a personnel database with a hyperlink field which contains the path to a mugshot. I was thinking of combining the hyperlink field with the surname field by putting the surname in the "Display Text" of the hyperlink. I have 200 or so existing records - can this be done either with code or in a query? I'm not sure of the syntax to use to reference the "Display Text" property (if it can be done at all). Many thanks. Keith.
20
2993
by: tshad | last post by:
I had posted this problem earlier and just noticed that the Hyperlink is the problem. Apparently, it doesn't figure out the path correctly. It uses the path of the file it is in, even if it is a control. I have 2 files "displayCompanyJobs.aspx" and "displayCompanyOverview.aspx" which are in both the folder "/jobseeker/" and "/employer/". I have a user control "displayCompanyJobs.ascx" that is in my /applicant/
13
42956
ADezii
by: ADezii | last post by:
Recently, there have been several questions and much confusion concerning the Topic of Hyperlinks. Specifically, Users wanted to know how to retrieve a File Name from a FileDialog Box, copy the Name to a Bound Text Box on a Form, and save the Hyperlink to the underlying Table. The code demos below will do just that: retrieve the Absolute Path of of File from a FileDialog Box, use the Base Name (no extension) as the Display Text for the...
1
2283
by: k lee | last post by:
I want to create a linkButton to activate my hyperlink which will open a new page in a new window. I would like to know how to code the code of activate the hyperlink which I wish to place it in the 'onclick' event of the linkButton.
1
2008
by: suvaline | last post by:
I dont know much about VBA, but maybe somebody can help me ;) I have this kind of SUB .. Sub kama2() Worksheets("kama").Activate Range("A51").Select Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True Application.WindowState = xlNormal Start_Timer End Sub ... and question ...
10
3001
by: sierra7 | last post by:
I'm trying to create a form where a user enters a document reference number and then clicks a command button to add a hyperlink to the document, via a file picker. Thanks to Adezii's excellent article http://bytes.com/topic/access/answers/725778-inserting-hyperlink-into-table I can manage to create a hyperlink to the document and store it in the table, but it is the full hyperlink path not the reference number of the document that is...
0
8706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8633
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9055
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8902
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5891
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3076
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2016
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.