troubleshooting Question

3061 error (MS/ACCESS) on "Set ...."

Avatar of João serras-pereira
João serras-pereiraFlag for Portugal asked on
Microsoft AccessVBA
9 Comments2 Solutions41 ViewsLast Modified:

I am getting a 3061 error (too many parameters, expected 1) on the following code:

    Dim zenvioSMSSet As Recordset
    Dim zenvioSMSSetProvisorio As Recordset
    Dim q01_selectUsers2smsSet As Recordset
    Dim zcontrolTableSet As Recordset
    Dim mboDB As DAO.Database
    Dim nDias As Integer
    Dim nDiasAdicionais As Integer
    Dim nDiaSemana As Integer
    Dim nMsg As Integer
    Dim strMsgText As String
    Dim strMsgTextClean As String
    Dim nidEnvio As Integer
    Dim strSendUserID As String
    Dim blnYesDay
On Error GoTo errorTrap
    Call logMe("frm_preparaEnvia btn_prepararSMS_Click", "start")
    strSendUserID = Nz(Forms!frm_loggedUserData!CurrentUserID, "") ' quem envia a mensagem
    If strSendUserID = "" Then
        MsgBox "[frm_preparaEnvia btn_prepararSMS_Click errorTrap]." & _
                "[user name].[NULO]"
        Call logMe("frm_preparaEnvia btn_prepararSMS_Click errorTrap", _
                    "[Form_Open_F00_Boot]." & "[user name].[NULO]")
        Exit Sub
    End If
    Set mboDB = CurrentDb
    Set zenvioSMSSet = mboDB.OpenRecordset("zenvioSMS", dbOpenDynaset)
    Set zenvioSMSProvisorioSet = mboDB.OpenRecordset("zenvioSMSProvisorio", dbOpenDynaset)
    Set q01_selectUsers2smsSet = mboDB.OpenRecordset("q01_selectUsers2sms_p02", dbOpenDynaset)
    Set zcontrolTableSet = mboDB.OpenRecordset("zcontrolTable", dbOpenDynaset)
    nDiasAdicionais = zcontrolTableSet!T00_numDiasMsg

Open in new window

it is on the line:
Set zcontrolTableSet = mboDB.OpenRecordset("zcontrolTable", dbOpenDynaset)

I can't understand why, becaus the table "zcontrolTable" does exist and, in the app, has be open before!

can anyone help?

kindest regartds
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros