'使後台可以正常訪問
Function OpenHt(HTmdbPath As String)
Dim fh As Integer
fh = FreeFile
Open HTmdbPath For Binary Access Write As #fh
Put fh, 2, &H1
Close #fh
End Function
'使後台無法正常訪問
Function CloseHt(HTmdbPath As String)
Dim fh As Integer
fh = FreeFile
Open HTmdbPath For Binary Access Write As #fh
Put fh, 2, &H0
Close #fh
End Function
'下面的都是跟後台建立物理連接的函數(必須放在模塊裡)
Public HTcn As Connection
Public HTrs As New ADODB.Recordset
Public HTsql As String
'建立物理連接
Function OpenStandHT()
Set HTcn = CurrentProject.Connection
'表1要改成相應的表名
HTsql = "select * from 表1"
HTrs.Open HTsql, HTcn, 3, 3, 1
End Function
'關閉物理連接的函數,如退出程序時,或需要壓縮後台文件時就要關閉物理連接
Function CloseStandHT()
HTrs.Close
Set HTcn = Nothing
End Function