ACCESS 常用模块

删除文件

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值