Code:
Private Sub cmdUnapproveProvider_Click()Dim mydb As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL
strSQL = Forms![frmMain].[lstTrainingProvideClassInfo].RowSource
Set mydb = CurrentDb
Set rst = mydb.OpenRecordset(strSQL)
If rst.RecordCount = 0 Then
MsgBox ("There are no records to act on")
GoTo StopAllThisNonsense
End If
rst.MoveFirst
While rst.EOF = False
strSeatsUsed = DLookup("CountOfStudentID", "qrySeatsUsedByClassID", "ClassID=" & Me.lstTrainingProvideClassInfo)
DoCmd.OpenForm "frmChangeSeatAvailability"
[Forms]![frmChangeSeatAvailability]![cboClassSelection] = Me.lstTrainingProvideClassInfo
[Forms]![frmChangeSeatAvailability]![txtCurApprovedSeats] = strSeatsUsed
DoCmd.OpenQuery "qryUnapproveClass"
DoCmd.Close acForm, "frmChangeSeatAvailability"
rst.MoveNext
Wend
DoCmd.OpenQuery "qryUnapproveTrainingProvider"
StopAllThisNonsense:
rst.Close
Set rst = Nothing
End Sub
I am getting the "Too Few Parameters. Expected 2" error on:
Code:
Set rst = mydb.OpenRecordset(strSQL)
This is cross posted at another location. I will update a solution if found there before here.
Also, if you happen to notice anything else that will be a problem, please bring it to my attention.