Microsoft Access 2010 数据库给我以下错误消息:
Compile Error: Expected End Of Statement
这是引发错误消息的方法:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Provide the user with the option to save/undo
'changes made to the record in the form
If MsgBox("Changes have been made to this record." _
& vbCrLf & vbCrLf & "Do you want to save these changes?" _
, vbYesNo, "Changes Made...") = vbYes Then
DoCmd.Save
Else
DoCmd.RunCommand acCmdUndo
End If
Dim sSQL As String
sSQL = "SELECT max(Clients.ClientNumber) AS maxClientNumber FROM Clients"
Dim rs As DAO Recordset
Set rs = CurrentDb.OpenRecordset(sSQL)
MsgBox ("Max client number is: " & rs.Fields(1))
End Sub
抛出错误消息的代码行是:
Dim rs As DAO Recordset
我不确定问题是否与前一行的语法有关。谁能展示如何解决这个问题?并解释发生了什么?