Share via

Microsoft Access DBase Error - Too few parameters. Expected 1.

Anonymous
2021-07-29T07:08:30+00:00

I have a DBase being run on Windows Enterprise, that has worked great for the last few years. I know have an error when opening a specific form "Too few parameters. Expected 1." I get the error and it throws me out of the DBase.

I have an event procedure (written by someone else) on the form, see below, if I delete the procedure I don't get the error, which would imply problems with the data ? But I checked and double checked and can't find a problem with the data. Help ! if possible ! Any help, guidance or suggestions welcome !

Option Compare Database

Option Explicit

Private Sub Form_Current()

Call Get\_Latest 

End Sub

Private Function Get_Latest()

Dim oParam1 As ADODB.Parameter

Dim oAdoResult As New ADODB.Recordset

On Error GoTo HandleError: 

If Not IsNull(Me![ProjCode]) Then 

    Set oParam1 = New ADODB.Parameter 

    oParam1.Type = adBigInt 

    oParam1.Value = Me![ProjCode] 

    Dim curTaward As Currency 

    Dim curGrant As Currency 

    Dim curLoan As Currency 

    If Run\_Query(oAdoResult, "getPanelLatest", oParam1) Then 

        ' should only be 1 entry 

        Do While Not oAdoResult.EOF 

            curTaward = oAdoResult("Total Awarded") & "" 

            curGrant = oAdoResult("Grant") & "" 

            curLoan = oAdoResult("Loan") & "" 

            oAdoResult.MoveNext 

        Loop 

    End If 

    Me![TAward].Caption = "£" & Format(curTaward, "0,0.00") 

    Me!Grant.Caption = "£" & Format(curGrant, "0,0.00") 

    Me!Loan.Caption = "£" & Format(curLoan, "0,0.00") 

End If 

HandleError:

End Function

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

6 answers

Sort by: Most helpful
  1. Anonymous
    2021-07-29T12:47:16+00:00

    Hi Imb_HB

    I read on internet search that may be the case, I've checked all fields and they are all there, no field names have changed for it to all of a sudden give me the error message.

    I don't know where else to look, there are a couple of other "Events" that happen when the form is loading. I deleted them and the form still errored, only when I deleted the above code on an event procedure did it not error which lead me to believe that this code is the problem.

    I am running it on Microsoft Apps for Business. If I run it on my personal version of Office 365 the error doesn't happen ???!!!

    Any help greatly appreciated.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-07-29T07:49:48+00:00

    I know have an error when opening a specific form "Too few parameters. Expected 1."

    ...

    If Run_Query(oAdoResult, "getPanelLatest", oParam1) Then

    ' should only be 1 entry

    Hi Teresa,

    This is typically an error that is generated when a field in the SQL-command is not found.

    I guess getPanelLatest. Is that an existing field?

    Imb.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2021-07-30T07:59:27+00:00

    So basically when it opens the form it looks in table 1 for the latest record and populates no. 2 at the top of the form. As I say it's always worked great then all of a sudden stopped (MS365 Apps for Business), however still works on my personal laptop with MS365. I've checked data several times all fine.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2021-07-30T07:55:34+00:00

    getPanelLatest query below, if I run it on it's own no problems, I'll post the outcome form as well

    Was this answer helpful?

    0 comments No comments
  5. Tom van Stiphout 40,201 Reputation points MVP Volunteer Moderator
    2021-07-29T23:28:24+00:00

    Please show the code of Run_Query.

    Was this answer helpful?

    0 comments No comments