在VBA中实现对记录集的操作!
<FONT size=2>假设我用以下过程实现了与数据库的连接</FONT><FONT size=2>Public strPath As String<BR>Dim adoCon As Connection '连接对象<BR>Dim adors4 As Recordset</FONT>
<FONT size=2>Private Sub UserForm_Initialize()<BR> <BR> '必须首先获得当前的工程路径<BR> strPath = ThisDrawing.Application.VBE.ActiveVBProject.FileName<BR> <BR> '连接数据库<BR> Set adoCon = New Connection<BR> adoCon.CursorLocation = adUseClient<BR> adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _<BR> Left(strPath, Len(strPath) - 8) & "road.mdb;"<BR> <BR> <BR> Set adors4 = New Recordset<BR> adors4.Open "Preferences", adoCon, adOpenDynamic, adLockOptimistic<BR> <BR> <BR>End Sub</FONT>
<FONT size=2>接下来在某个按扭的单击事件中,通过adoRs4.RecordCount > 0判断记录集是否为空,不为空的话,就要清空所以记录!怎么样清空所以记录呢?????</FONT> 以上帖不用回了!
页:
[1]