Link to home
Create AccountLog in
Avatar of luciepaul
luciepaul

asked on

VBA Access error 3061 & 3265

Here comes the code that gives me an error runtime
30    StrParam = "Parameters [NBRound] Integer, [NbHole] Integer; "
40    sqlsuppshot = StrParam & "DELETE * " _
      & " FROM TbShots " _
      & " WHERE nbRoundID = [NbRound] " _
      & " AND nbholenb = [nbHole];"
50    Set qdf = Db.CreateQueryDef("suppshot", sqlsuppshot)
60    qdf.Parameters("NbRound").Value = 24
70    qdf.Parameters(NbHole).Value = 7
80    Db.Execute "suppshot", dbFailOnError

First run returns error 3061 too few parameters
Second run returns error 3265 item not found

Thanks for the help
Avatar of luciepaul
luciepaul

ASKER

Error 3061 comes on line 60
Error 3265 comes on line 70
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I'm now back to the "error 3061" problem; too few parameters !
Thank's anyway.
Seems like a long shot, but maybe that is case sensitive:

StrParam = "Parameters [NBRound] Integer

verses

qdf.Parameters("NbRound").Value = 24
                              ^
If not ...

Can you upload the db ...?
I've grabbed a small part of the whole database to isolate the problem ( one form, one cmd button, one proc)
I've added four msgbox lines to check the parameters values & names and it seems to work well.
So.... your turn expert !
The "delete object"line in line 20 is awkward but it's a quick & dirty way to save time for trial purpose only
Thanks again Trial1.accdb
I will look at this tomorrow.  I have a band gig to get ready for now ...

mx

On the first db i'd left unneccesary code lines. hereunder comes a better one
Trial1.accdb