1
我無法通過打開Ms Access Query來獲取記錄數,我使用以下代碼。MS Access中的DAO方法
Private Sub CmdGetData_Click()
Dim WRK As Workspace
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim StrSql As String
Set WRK = DBEngine.Workspaces(0)
Set db = CurrentDb
StrSql = "select * from [QrySalePatti]"
Set rs = db.OpenRecordset(StrSql, dbOpenDynaset)
Do While (Not rs.EOF)
rs.MoveFirst
rs.MoveLast
MsgBox rs.RecordCount
Loop
exitRoutine:
If Not (db Is Nothing) Then
db.Close
Set db = Nothing
End If
Set WRK = Nothing
End Sub
歡迎來到StackOverflow。你已經很好地添加了有問題的代碼,但仍然缺少重要的細節:程序的* expected *輸出是什麼,你得到的* actual *輸出是什麼?請使用您問題下方的「編輯」鏈接添加該信息。 – Heinzi