Solved

Use data to create Hyperlink..?

Posted on 2000-03-14
8
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 50 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

623 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