|
Private Sub Image21_Click()
Dim a As String
Dim STemp As String
Dim d As String
Dim e As String
Dim path As String
Dim c As String
Dim rs As ADODB.Recordset
'为定义的数据集变量分配空间
Set rs = New ADODB.Recordset
'为打开数据表“查询语句”字符变量赋值
a = InputBox("请输入五位数的单号,例如61002, 产品型号不用输入", "输入单号")
STemp = "Select * From 投料单明细 where 单号=" & a & ";"
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 0 Then
MsgBox "单号输入错误,或者投料单还未输入!"
Else
d = rs("单号")
e = rs("型号")
c = Mid(d, 2, 2)
path = "E:\MIS\投料单\06年投料单\" & c & "月份\QO" & d & e & ".xls"
这里的path得到正确的值以后,我就想直接执行以下的程序,即把path所代表的文件打开,主要是一个shell
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
ShellExecute 0, "Open", path, "", "", 5
但是我不能直接放在这里,因为事先要声明,我不知道正确的格式,请问谁能告诉我?谢谢
End If
End Sub
|
|