Access 2000 Error # 3061 - TechRepublic
General discussion
March 17, 2001 at 03:32 AM
donq

Access 2000 Error # 3061

by donq . Updated 25 years, 3 months ago

I have a Function named ?ArchLedger()? that works great when I hard code dates (#date#) and start it via the Immediate window. ArchLedger is called (call ArchLedger) from a button on a form named BkpgMgr that contains BeginArch (Date) and EndArch (Date) Fields. The query I used to create the code assigned to ?SqlStr? also works fine when I manually enter the required date range values. When I click the button on BkpgMgr I receive ?Error # 3061 was generated by DAO.Database Too few parameters. Expected 2.? The query contains ?Between[Forms]![BkpgMgr].[BeginArch] And [Forms]![BkpgMgr].[EndArch]? within the Criteria slot under the records Date field and as far as I can see this should work fine? I tried ActiveForm, Me, and everything else I think should work but consistently get the same #3061 error generated by Jet. As you can see my procedure is tied to the Tables (as it should be) and not a query ? I just built the query to test and because I?m lazy.

Function ArchLedger()’DEFINE A PROCEDURE TO POST GenLedger RECORDS INTO THE ArchLedger TABLE
‘WHEN THE RECORDS FALL WITHIN A USER SPECIFIED DATE RANGE.

‘ENABLE PROCEDURAL ERROR HANDLING.
On Error GoTo ArchLedger_Err

‘DECLARE AND INITIALIZE THE CURRENT DATABASE AS THE DATABASE TO USE.
Dim DB As Database
Set DB = CurrentDb()

DoCmd.Hourglass True ‘CONVERT THE CURSOR TO AN HOURGLASS.

‘DECLARE TEMPORARY RECORDSET VARIABLES TO REPRESENT THE SOURCE AND TARGET OBJECTS.
Dim AGL As Recordset ‘Object Model’s “ArchLedger” (target) TABLE.
Dim GL As Recordset ‘Object Model’s “GenLedger” (source) TABLE.

‘OPEN THE TARGET RECORDSET USED WITHIN THIS PROCEDURE.
Set AGL = DB.OpenRecordset(“ArchLedger”, dbOpenDynaset)

‘DECLARE PROCEDURE STRING MANAGEMENT VARIABLES.
Dim SqlStr As String ‘SQL Strings.
Dim MBstr As String ‘Message Box Strings.

‘OPEN THE DATE RANGE (SOURCE and/or DRIVER) RECORDSET USED WITHIN

This discussion is locked

All Comments