3061 Too few parameters. Expected 1 Microsoft Access 2010

marlind618

Registered User.
Local time
Today, 09:25
Joined
May 22, 2013
Messages
15
I have a problem I can't resolve. I get an error 3061 Too few parameters. Expected 1. Microsfot Access 2010. I can put a regular date in and it works but I have chose to have the user to input the date in a txt box. Here is the sql SELECT qryhourmin.[The Minutes], qryhourmin.Starttime, qryhourmin.EmpName, qryhourmin.dateindbtl, qryhourmin.EventID, qryhourmin.Requester, qryhourmin.RequestNumber, qryhourmin.DateReq, qryhourmin.Stoptime, qryhourmin.ActualTime, qryhourmin.Minutes, qryhourmin.DBrequestersdetails, qryhourmin.worktype, qryhourmin.WorkCodeID, qryhourmin.DescriptionDBID, qryhourmin.Description, qryhourmin.WorkCode, tblsystemnotes.SystemText, qryhourmin.systemnotesid
FROM tblsystemnotes RIGHT JOIN qryhourmin ON tblsystemnotes.systemnotesid = qryhourmin.systemnotesid
WHERE (((qryhourmin.EmpName)=networkusername()) And ((qryhourmin.dateindbtl)=(Forms!frmpublicrecordstimesheet!txtselstartdate)))
ORDER BY qryhourmin.Starttime;
I think the error is in the(Forms!frmpublicrecordstimesheet!txtselstartdate) this is where I can manually put the date.

Any help would be appreciated.
 
I made some changes and I get the same thing. If I just type in a date in the query it works.
 
How do I put the "#" symbol in front of the date. Everything works when I put the date in. Acccess adds the "#"
 
If you are using SQL in VBA, make sure you concatenate the values, unlike Query grid, where you simply use them.. Try..
Code:
Dim strSQL As String
strSQL = "SELECT qryhourmin.[The Minutes], qryhourmin.Starttime, qryhourmin.EmpName, qryhourmin.dateindbtl, qryhourmin.EventID, " & _
         "qryhourmin.Requester, qryhourmin.RequestNumber, qryhourmin.DateReq, qryhourmin.Stoptime, qryhourmin.ActualTime, qryhourmin.Minutes, " & _
         "qryhourmin.DBrequestersdetails, qryhourmin.worktype, qryhourmin.WorkCodeID, qryhourmin.DescriptionDBID, qryhourmin.Description, " & _
         "qryhourmin.WorkCode, tblsystemnotes.SystemText, qryhourmin.systemnotesid FROM tblsystemnotes RIGHT JOIN qryhourmin " & _
         "ON tblsystemnotes.systemnotesid = qryhourmin.systemnotesid WHERE ((qryhourmin.EmpName = [COLOR=Red][B]'" &[/B][/COLOR] networkusername() [COLOR=Red][B]& "'[/B][/COLOR]) And " & _
         "(qryhourmin.dateindbtl = [COLOR=Red][B]#" & Format([/B][/COLOR]Forms!frmpublicrecordstimesheet!txtselstartdate[COLOR=Red][B], "mm/dd/yyyy") & "#[/B][/COLOR])) ORDER BY qryhourmin.Starttime;"
Please use CODE tags, to make code more readable..
 

Users who are viewing this thread

Back
Top Bottom