Avatar of João serras-pereira
João serras-pereiraFlag for Portugal

asked on 

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

Hi

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")
    Me.Refresh
    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)
    zcontrolTableSet.MoveFirst
    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
Microsoft AccessVBA

Avatar of undefined
Last Comment
João serras-pereira
Avatar of João serras-pereira
João serras-pereira
Flag of Portugal image

ASKER

just to add a bit: yesterday this was perfectly working.

In addition, I have just commented the  line and now I am getting the error on the line 33:
Set q01_selectUsers2smsSet = mboDB.OpenRecordset("q01_selectUsers2sms_p02", dbOpenDynaset)

sigh


SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of João serras-pereira

ASKER

nope.

I've compacted/repair
then comiled
created e new clean DB
imported all objects and references
and getting the same error, even removing, for all, your suggestion of removing the dbOpenDynaSet


This was perfectly working yesterday!
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of João serras-pereira

ASKER

Hi Dale,

zControlTable is a Table (not a query) with just 1 record, and its fields are the columns of the table....
I opened a backup DB and found exactly the same code and is running...

sigh
Avatar of João serras-pereira

ASKER

I believe that there is something else...
Avatar of João serras-pereira

ASKER

The problem was in the query on line 33.... The query was partially destroyed. (it even did not showthe tables in Table view...) I developed a novel one, replaced and it is up and running!

Now I can't tell why this goes to zControltable, but... I happy as a bird!
<<I opened a backup DB and found exactly the same code and is running... >>

Are you OK then or no?

If not,
 1. Does your app compile without errors?
 2. Can you open zcontrolTable directly without error?
 3. Do you have a query with the name zcontrolTable?

 If yes, no, no, then I think John was on the right track....maybe an expression as part of a default value for a field in the table.

Jim.

Avatar of João serras-pereira

ASKER

Well ... It compiled without error, so It's OK now that the error was found.

big thanks t the team
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo