我一直在绞尽脑汁试图找出这个查询有什么问题,但我只是看不到它。我正在尝试打开一个记录集,但我不断收到运行时错误 3061:“参数太少:预期为 1。”
这是我的代码...
Dim ansRs As Recordset
Dim qRs As Recordset
Dim ansQuery As String
Dim qQuery As String
Dim i As Integer
qQuery = "Select * From TrainingQuizQuestions Where TrainingQuizID = (Select TrainingQuiz.TrainingQuizID From TrainingQuiz Where QuizName = Forms!MainMenu!txtVidName);"
ansQuery = "Select * From TrainingQuizQuestAns"
Set qRs = CurrentDb().OpenRecordset(qQuery)
Set ansRs = CurrentDb().OpenRecordset(ansQuery)
我从“Set qRs = CurrentDb().OpenRecordset(qQuery)”行收到错误消息。我将该查询复制并粘贴到访问中并运行它,它准确地返回了我想要在我的记录集中获得的内容,但是当我在 VBA 中运行它时出现错误。我错过了一些非常简单的东西吗?任何帮助将不胜感激。