Function kill_file(abcd)
'delete the file
If IsFileExists(abcd) = True Then
Kill abcd ' delete
End If
End Function
Function run_exe_v()
On Error Resume Next
' run the exe
f_p = file_path()
store_path = f_p & "\123.exe"
ShellExecute Me.Hwnd, "open", store_path, "", "", 1 'run the exe
End Function
:
如果需要延迟时,需要在模块中提前做声明
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare PtrSafe 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 sub()
If Len(Text16) <> 0 Then
If InStr("cell", Text16) = 0 Then
DoCmd.GoToControl "cell_name"
DoCmd.FindRecord Text16 & "*"
End If
end sub
function Sub Co(file_path,file_content)
Set file_abc = CreateObject("scripting.filesystemobject")
Set ntxt = file_abc.opentextfile(file_path, 8, True)
'????????"d:\n.txt"
ntxt.writeline file_content
ntxt.Close
Set file_abc = Nothing
end function
Function run_exe_seaerch_V()
On Error Resume Next
f_p = file_path()
account_n = LCase(Environ("USERNAME"))
T_path1 = f_p & "\parameter.csv"
Do Until IsFileExists(T_path1) = True
Sleep 2000
Loop
End Function
DoCmd.OpenQuery "Cal_AccessVer_FTP_Up_MOE"
DoCmd.OpenQuery "Cal_AccessVer_Local_Up_MOE"
ShellExecute Me.Hwnd, "open", f_p, "", "", 1 'open the folder
'......copy file to the localtion
database_path = DLookup("text_p1", "Parameter_access", "Item_Para = '" & "File_path" & "'")
dd = Format(Date, "YYYY_MM_DD")
复制文件
sourch_file = Application.CurrentProject.Path & “\123.accdb”
copy_name = database_path & “\1234.accdb”
FileCopy copy_name, sourch_file
DoCmd.RunSQL “UPDATE…”
Function disable_warning()
DoCmd.SetWarnings False
End Function