'使后台可以正常访问
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