Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use data to create Hyperlink..?

Posted on 2000-03-14
8
Medium Priority
?
172 Views
Last Modified: 2010-05-02
I want to know how it is possible to insert a search for a specific file.  At the moment I have a hyperlink to an Excel file called C:\Test\Test_01_01_2000.xls and another C:\Test\Test_02_01_2000.xls, basically every day a new file is created in the format. Test(filename)_01(day)_02(month)_2000(year).  What i would like to accomplish is to insert something like 3 text boxes on my form called ,day ,month and year.  Once the user inserted the data in the text boxes and you click the Submit button it should point to the relevant hyperlink. For example in the text box Day the user inserted 05 and the textbox month the user inserted 03 and textbox year the user inserted 2000, once inserted and you click the submit button the the results should the point to C:\Test\Test_05_03_2000.xls
0
Comment
Question by:fouchev
  • 4
  • 2
  • 2
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2615464
What are you using to create your hyperlink? The hyperlink will normally take the form of a string:

"file://c:/test/test_01_01_2000.xls" this could easily be built up as you describe.
0
 
LVL 1

Author Comment

by:fouchev
ID: 2615466
Edited text of question.
0
 
LVL 1

Author Comment

by:fouchev
ID: 2615477
Edited text of question.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:fouchev
ID: 2615498
Very quick there Tim,

Well at the moment the the hyperlink is under the properties of a command button called btnSubmit. Once I change the data in the text boxes, i need the hyperlink in the button properties to change accordingly.  Is this clearer?
0
 
LVL 2

Accepted Solution

by:
gelog earned 200 total points
ID: 2615676
Why do you use textboxes for date input? It is more elegant solution to use DateTimePicker (Calendar) Control.

Include to a project Windows Common Controls - 2. Place the DateTimePicker on the form, also add the button control.

Insert the following code to the from code module:

Private Sub Command1_Click()
    MsgBox Command1.Tag
End Sub

Private Sub DTPicker1_Change()
   
    With DTPicker1
        Command1.Tag = "C:\Test_" & Day(.Value) & _
            "_" & Month(.Value) & "_" & Year(.Value) & ".xls"
    End With
           
End Sub

Run the project, click on the buuton, you sould see the result in a message box.

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2615726
Are you using a DHTML project, VB Script or ActiveX document model to do this with? Gelog's comment is possibly helpful as it may well be a nicer interface to go with, however you would still have to format the date parts correctly to get "01" instead of "1" for the day and month.

0
 
LVL 1

Author Comment

by:fouchev
ID: 2619966
Hi again,
I works fine, it displays in the message box, but how do get it to go to the file (hyperlink) now. Must one put code behind the Ok button or what..?  
0
 
LVL 2

Expert Comment

by:gelog
ID: 2620073
Insert in the Global_Declarations section of the form code module the following API declaration:

Private 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

In the Command1_Click event procedure insert the call of ShellExecute instead of the call of MsgBox:


ShellExecute 0&, "Open", Command1.Tag, 0&, 0&, 1&
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question