填写表格到SubForm ACCESS vba

时间:2019-01-21 07:33:50

标签: ms-access subform

我具有应用程序MS Access,并且具有通过IP与另一台计算机建立连接的路径, 如何在SubForm上获取所有记录列表?

Sub Load_All_User()
Dim cn As Object
Dim rst As Object
Dim strConnection As String
Dim strSql As String

Set cn = CreateObject("ADODB.Connection")
strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & "\\172.16.25.5\ACC\" & "test_connect.mdb"
strSql = "SELECT * FROM tbUser"
cn.Open strConnection
Set rst = cn.Execute(strSql)

If rst.BOF And rst.EOF Then
MsgBox "No data found"
Exit Sub
Else
    Child7.SourceObject=??????????????
End If

rst.Close
Set rst = Nothing
cn.Close
Set cn = Nothing
End Sub

0 个答案:

没有答案