2023年11月23日发(作者:)
假设前台数据库⽂件名为
后台数据库⽂件名为
frontBase当中有链接表tbl1, tbl2, tbl3, …,链接到中
⾸先我们要在前台数据库⽂件的启动窗体加载事件中判断链接是否正确
⽅法是打开任意⼀个链接表,假设为tbl1,代码如下:
Public Function CheckLinks() As Boolean
’ 检查到后台数据库的链接;如果链接存在且正确的话,返回 True 。
Dim dbs As Database, rst As set
Set dbs = CurrentDb()
’ 打开链接表查看表链接信息是否正确。
On Error Resume Next
Set rst = cordset(“tbl1”)
’ 如果没有错误,返回 True 。
If Err = 0 Then
CheckLinks = True
Else
CheckLinks = False
End If
End Function
le = 255
ileTitle = Space(254)
leTitle = 255
nitialDir =
itle = "后台数据⽂件为"
= 6148
rtn = GetOpenFileName(ofn)
us
If rtn = True Then
发布评论