'strQuery是表名,查询名等
Public Function Getrs(Byval strQuery as string) as ADODB.Recordset
Dim objRs As New ADODB.Recordset
on Error GoTo Error_Getrs
objRs.open strQuery,CurrentProject.connection
'程序调试用
'Do While Not objRs.EOF
' Debug.Print objRs(0) & vbTab & objRs(1) & vbTab & _
' objRs(2)
' objRs.MoveNext
'Loop
Set Getrs =objRs
Exit _Getrs:
Exit Function
Error_Getrs:
MsgBox (Err.Description)
Resume Exit _Getrs
End Function
access vba 用recordset读取表中数据的简单方法
最新推荐文章于 2024-10-01 17:19:31 发布