一个微软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
我不确定问题是否必须做用它前面的行的语法。任何人都可以展示如何解决这个问题?并解释发生了什么?
不,那不是我的建议 - 读一遍...使用*或者*'rs.Fields(0)'*或* rs!maxClientNumber' - 你的'rs!Fields(0)'是一个混乱。 –
如果有人想知道这是对现在已被删除的评论的回复,虽然这个观点仍然存在(你不能使用砰的操作员按位置进行索引)... –
这不是问题所在。 – CodeMed