I have a few queries in my app that I've rewritten to work with parameters. They all work fine.
When I went to update this part of the code today though, I've run into trouble and can't get this working.
I need it to query data for six Wednesday's but since it isn't working I've commented everything out to try and get just a single Wednesday to return. Every time I execute the query it returns "An Error Has Occurred - No Value Given For One Or More Required Parameters".
I feel like this is a super silly error that I'm glazing over and could use another set of eyes.
Thanks.
Code:Dim dtFirstWednesday As Date dtFirstWednesday = strWednesdayDate(0) ' dtSecondWednesday = strWednesdayDate(1) ' dtThirdWednesday = strWednesdayDate(2) ' dtFourthWednesday = strWednesdayDate(3) ' dtFifthWednesday = strWednesdayDate(4) ' dtSixthWednesday = strWednesdayDate(5) 'Now query the database using the dates of the 6 Wednesday's obtained above. strSQL = "Select Distinct PROD.CSU_CLINIC_INFO.CLINIC_DATE, PROD.CSU_CLINIC_INFO.OCCURS " & _ "From PROD.CSU_CLINIC_INFO WHERE PROD.CSU_CLINIC_INFO.CLINIC_DATE = ?" Dim objCommand As ADODB.Command Set objCommand = New ADODB.Command With objCommand .ActiveConnection = SQLCon .CommandType = adCmdText .CommandText = strSQL .Prepared = True .Parameters.Append .CreateParameter("FirstWed", adDate, adParamInput, , dtFirstWednesday) ' .Parameters.Append .CreateParameter("SecondWed", adDate, adParamInput, , dtSecondWednesday) ' .Parameters.Append .CreateParameter("ThirdWed", adDate, adParamInput, , dtThirdWednesday) ' .Parameters.Append .CreateParameter("FourthWed", adDate, adParamInput, , dtFourthWednesday) ' .Parameters.Append .CreateParameter("FifthWed", adDate, adParamInput, , dtFifthWednesday) ' .Parameters.Append .CreateParameter("FifthWed", adDate, adParamInput, , dtSixthWednesday) End With rsGetRotationWeeks.Open strSQL, SQLCon, adOpenStatic, adLockOptimistic




Reply With Quote