How to use Textbox.Value in code?

David Ball

Registered User.
Local time
Tomorrow, 05:24
Joined
Aug 9, 2010
Messages
230
Hi,

The code below opens the PDF document - 2WLAPAS.pdf – from a folder on my desktop.
Code:
Option Explicit
Option Compare Database
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
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Sub CmdOpenDoc_Click()
 
ShellExecute 0, "Open", "C:\Users\David.Ball\Desktop\ScannedFiles\[B]2WLAPAS.pdf[/B]", vbNullString, "C:\", SW_SHOWNORMAL
End Sub

I have a form that displays the document details such as name and description, one document per page, and it has a command button that runs the code on the On Click event.
I want to be able to scroll through the form until I come to the page for a document that I am interested in and then click the command button to open the PDF for that document.
The document numbers are in a textbox called FICNo
So, I need some way of getting FICNo.Value into my code instead of the hard-coded 2WLAPAS, and, I guess, concatenate it with .pdf
I don’t know how to do that. I have tried for a few hours and am getting nowhere.
Can anyone please advise how I can do this?
Thanks very much
Dave
 
Try

"C:\Users\David.Ball\Desktop\ScannedFiles\" & Me.FICNo & ".pdf"
 
That works. Thanks very much
 

Users who are viewing this thread

Back
Top Bottom