Solved

Microsoft Access 2010 3061 Too Few Paramaters Expected 1

Posted on 2014-01-29
2
322 Views
Last Modified: 2014-01-29
I thought I licked this problem but didn't. At the end of the day the user needs to click "Submit End of Day Report" on the form This will check for errors based on parameters I checked for. Only trouble is I get this 3061 Too Few Paramaters Expected 1 error. The query I am using is on the form and working fine. This comes from a larger database so I extracted all the relevant part for my question. You just need to open the form Frmtimesheet and clilck on the submit end of day report. The module modendof day is as follows:
Public Function myendofday(strmyday As Date)

  On Error GoTo Err_myendofday
  DoCmd.OpenForm ("frmpleasewait")
  DoCmd.RepaintObject acForm, "Frmpleasewait"
 
Dim db As DAO.Database
Dim rec As Recordset
Dim Enderrormsg As Label
Dim i As Integer
Dim j As Integer
Dim conflict As Integer 'system errors noted
Dim intRnd As Integer
Dim mycount As Integer  'total records done by user
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
 DoCmd.RepaintObject acForm, "Frmpleasewait"
Set db = CurrentDb()
'Set rec = db.OpenRecordset("tblpublicrecordstimesheet")
Set rec = db.OpenRecordset("qrysubrequesttime")

conflict = 0
mycount = 0
Do While Not rec.EOF
    rec.Edit
    Select Case rec("systemnotesid")
    Case Is <> 0
    conflict = conflict + 1
    Case Is = 0
    mycount = mycount + 1
    End Select
    rec.MoveNext
Loop
rec.Close

MsgBox (conflict)
MsgBox (mycount)

'If conflict > 0 Then GoTo Enderrormsg Else DoCmd.OpenForm ("End of Day Response")
If conflict > 0 Then GoTo Enderrormsg Else GoTo NoErrors

NoErrors:
MsgBox ("No Errors")
    DoCmd.Close acForm, "frmpleasewait"
Msg = "Do you wish to authenticate the End of Day Report ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "End Of Day"
Help = "DEMO.HLP"
Ctxt = 1000
If mycount = 0 Then DoCmd.OpenForm ("End of Day Response") Else If mycount > 0 Then Response = MsgBox(Msg, Style, Title, Help, Ctxt)

If Response = vbYes Then    ' User chose Yes.
    MyString = "Yes"    ' Perform some action.
 
    
  '  DoCmd.OpenForm ("End of Day Response")
Dim rs As DAO.Recordset
 
'Me.TimerInterval = 0
Set rs = CurrentDb.OpenRecordset("Select * From tbleod")
rs.AddNew
rs!Employeeeod = Networkusername()
rs!ReportDate = strmyday
rs.Update
rs.Close

Dim myfilename As String
myfilename = "W:\EndofDayReports\"
myfilename = myfilename & DatePart("yyyy", strmyday) & "." & DatePart("m", strmyday) & "." & DatePart("d", strmyday) & "_" & Networkusername()
myfilename = myfilename & ".pdf"
     DoCmd.OutputTo acOutputReport, "rptendofday", "PDFFormat(*.pdf)", myfilename, True, "", , acExportQualityScreen
Else    ' User chose No.
    MyString = "No"    ' Perform some action.
End If
    Exit Function
    
Exit_myendofday:                          ' Label to resume after error.
   Exit Function                   ' Exit before error handler.
Enderrormsg:
  MsgBox "You must correct error before submitting the End of Day report.!", vbOKOnly, "DB"
   DoCmd.Close acForm, "frmpleasewait"
   Exit Function
Err_myendofday:                           ' Label to jump to on error.
     MsgBox Err.Number & Err.Description ' Place error handling here.
     DoCmd.Close acForm, "frmpleasewait"
     Resume Exit_myendofday
End Function

Open in new window

you should use the date 1/28/2014 if the date goes away.
I have attached a copy of the database. Thanks in advance for the help.
toofewerror.zip
0
Comment
Question by:marlind605
2 Comments
 
LVL 10

Accepted Solution

by:
Gozreh earned 500 total points
ID: 39819282
Change this
" Set rec = db.OpenRecordset("qrysubrequesttime") "
to
Dim qdf As QueryDef
Set qdf = db.QueryDefs("qrysubrequesttime")
qdf.Parameters("[Forms]![frmtimesheet]![txtselstartdate]") = CDate([Forms]![frmtimesheet]![txtselstartdate])
Set rec = qdf.OpenRecordset

Open in new window

0
 

Author Closing Comment

by:marlind605
ID: 39819623
mGozreh If I could give more points I would. Thanks a billion. This will help me on other parts of the database.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now