Private Sub Form_Load()
On Error GoTo Except
Dim ConnStr As String
ConnStr = "File Name=" & CurrentProject.Path & "\ast.udl;"
Dim Conn As ADODB.Connection
Set Conn = New ADODB.Connection
Conn.Open ConnStr
Dim Recordset As ADODB.Recordset
Set Recordset = New ADODB.Recordset
Recordset.Open "select * from Employe", Conn
'以下的写法会出错,不知道怎么写!
' Set Me.Recordset = Recordset
' Set ID.Requery = Recordset.Fields("ID")
' Set Name.Requery = Recordset.Fields("Name")
Exit Sub
Except:
MsgBox "error"
End Sub