举一例子而已,希望大家可以举一反三。
1、您可以以此代码开发一个管理ACCESS文件的软件。
2、您也可以将不同的数据库放到一个窗体上进行管理。
……
窗体中代码:
Private Sub 命令0_Click()
Dim stAppName As String
Dim strFileName As String
strFileName = ShortName(CurrentProject.Path + "\db2.mdb")
stAppName = "MSAccess.exe " & strFileName
Call Shell(stAppName, 1)
DoCmd.Quit acQuitSaveAll
End Sub
'模块中代码
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Function ShortName(ByVal LongName As String) As String
Dim sBuff As String
Dim x As Long
sBuff = Space$(512) ' make space
x = GetShortPathName(LongName, sBuff, Len(sBuff))
ShortName = Left$(sBuff, x)
End Function
[UseMoney=1][/UseMoney]
[此贴子已经被作者于2003-6-4 13:18:10编辑过]
|