By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,699 Members | 1,243 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,699 IT Pros & Developers. It's quick & easy.

Hyperlink query

P: 1
I hope I can make this clear. I have a combo box that allows the user to query an IP address. They type in an IP address and the results are returned via a form that allows them to click on the IP address in a box and go to that printers web page. The problem is on the table where the query is based from, in the hyperlink column, I entered in the respective IP addresses and enabled the hyperlink for the column. However if the user enters in the IP address (i.e. 10.11.10.11) in the query, it comes back as no results. The reason is that the table's hyperlink now reads: 10.11.10.11#http://10.11.10.11# I can't expect the user to type in all the additional characters to get a proper result. Is there any way to get around this? I am a self-taught novice so be gentle...
Thanks!
May 23 '07 #1
Share this Question
Share on Google+
1 Reply

theaybaras
P: 52
Hi there...
I have done something similar to this using macros. I'm sure there are ways to do this with only a script... but. This is what i have to offer, and it is really much more simple than its steps make it seem.
---------------------------------------------
I'm making a couple of assumptions below...
1. User selects an IP address from a combobox named "COMBONAME"
2. User clicks on a separate object to pull up printers website.
3. The hyperlink can be created live, (hyperlink is not stored).
4. Form name is "FORMNAME" , label is named "link"
5. Macro name is "MACRONAME"
---------------------------------------------
In the form with your combobox, create an unbound label near the combobox the user will select the IP address in. Have it's caption say "Go to printer" or something... we're naming this label link in its properties. Also in its properties, set "is hyperlink" to yes but leave "hyperlinkaddress" blank. Save the form.
----------------------------------------------
Create a new macro and title it MACRONAME
Have the first action set to "SetValue"
In the properties for SetValue input the following into the Item information
[Forms]![FORMNAME]![link].[HyperlinkAddress]
([HyperlinkAddress] isn't something you need to change the name of... its the aspect of the label "link".
In the properties for SetValue input the following into the Expression information
"http://" & [COMBONAME]
Save macro.
----------------------------------------------
Now, in your form insert the following code in the form properties in the appropriate place. Here I'm assuming I want Form_Current, I'll leave it up to you to find the right place.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. On Error GoTo Err_Form_Current
  3.  
  4.     Dim stDocName As String
  5.  
  6.     stDocName = "MACRONAME"
  7.     DoCmd.RunMacro stDocName
  8.  
  9. Exit_Form_Current:
  10.     Exit Sub
  11.  
  12. Err_Form_Current:
  13.     MsgBox Err.Description
  14.     Resume Exit_Form_Current
  15. End Sub 
---------------------------------------------------
---------------------------------------------------
I hope this was clear, I've been a bit distracted while writing. Let me if you have questions or can't figure out what I mean... Or also if you get it to work :) For me, this allowed my user to select an IP address from my combobox, and immediately click on a label next to the combo box, and it brings up the ip address with http:// in front, in their default browser.

theAybaras.
May 24 '07 #2

Post your reply

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