Lightlancer
Programmer
Hi all,
In a form i have a Hardwarenumber and in a subform a subnumber
Mainform:
Field: [Hardwarenumber]
Subform
Field: [Subno]
Now when a user clicks on a button, VBA must decide wich document to open (he must open a usermanual dedicated to the hardwarenumber)
I already tried something with this code i found somewhere on tektips
but this doesnt work.........
so, the path to the files are U:\Manuals\
and the files are named *****.***.doc
Like: 00075.002.doc
where, 00075 = [hardwarenumber]
and
002 = subno
VBA must put a . between the 2 fields and add .doc.
offcourse before this must be: U:\Manuals\
How can i do this,
if someone can give the right solution..... that person deserves a star
Greetz
Lightlancer
P.S. if more info is needed, Please ASK!
In a form i have a Hardwarenumber and in a subform a subnumber
Mainform:
Field: [Hardwarenumber]
Subform
Field: [Subno]
Now when a user clicks on a button, VBA must decide wich document to open (he must open a usermanual dedicated to the hardwarenumber)
I already tried something with this code i found somewhere on tektips
Code:
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
' Button launches Word and opens a specified document
' And runs an optional macro. the macro could print out the word doc and quit
Dim retval As Variant
Dim DocName, MacroName As String
' Drive and Full path to name and location of Word document
DocName = "F:\Somefolder\ me.hardwarenumber & me.subChange.form!subno"
'Optional Macro Name. Note Word Macro name cannot have any spaces in it.
'MacroName = "/M" & "MacroName"
'Note full path to Word including Drive and folder
retval = Shell("c:\Microsoft Office97\office\WinWord.exe" & " " & DocName & MacroName, vbNormalFocus)
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
but this doesnt work.........
so, the path to the files are U:\Manuals\
and the files are named *****.***.doc
Like: 00075.002.doc
where, 00075 = [hardwarenumber]
and
002 = subno
VBA must put a . between the 2 fields and add .doc.
offcourse before this must be: U:\Manuals\
How can i do this,
if someone can give the right solution..... that person deserves a star
Greetz
Lightlancer
P.S. if more info is needed, Please ASK!