Howlsta
Vampire Slayer
- Local time
- Today, 05:52
- Joined
- Jul 18, 2001
- Messages
- 180
When I press the command button on my form i get the following error:
too few parameters, expected two.
But both the combo boxes for module and student are filled (I assume they are the parameters), so i can't understand why this happens. Any ideas anybody?
I've included the code below
If i put the cursor over rstStudentMod it comes up rstStudentMod = nothing - which sounds like there may be something wrong!
Private Sub cmdAdd_click()
Dim db As Database
Dim rstStudentMod As Recordset
If IsNull(Me.cboStudent) Or _
IsNull(Me.CboModule) Then
MsgBox "A module and student must be selected"
Else
Set db = CurrentDb()
Set rstStudentMod = db.OpenRecordset("qryPutStudentonModule", _
dbOpenDynaset)
With rstStudentMod
.AddNew
!StudentID = Me!cboStudent
!ModuleCode = Me!CboModule
.Update
End With
Me!CboModule = rstStudentMod!ModuleCode
End If
End Sub
too few parameters, expected two.
But both the combo boxes for module and student are filled (I assume they are the parameters), so i can't understand why this happens. Any ideas anybody?
I've included the code below
If i put the cursor over rstStudentMod it comes up rstStudentMod = nothing - which sounds like there may be something wrong!
Private Sub cmdAdd_click()
Dim db As Database
Dim rstStudentMod As Recordset
If IsNull(Me.cboStudent) Or _
IsNull(Me.CboModule) Then
MsgBox "A module and student must be selected"
Else
Set db = CurrentDb()
Set rstStudentMod = db.OpenRecordset("qryPutStudentonModule", _
dbOpenDynaset)
With rstStudentMod
.AddNew
!StudentID = Me!cboStudent
!ModuleCode = Me!CboModule
.Update
End With
Me!CboModule = rstStudentMod!ModuleCode
End If
End Sub