• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

MS Access - "No values given for one or more parameters"

manish prasher

New Member
i have an ongoing error in ms access vba, being pretty new to the app i am stuck, i have a split database where in i am trying to execute a query in vba but it is throwing the error"No values found for one or more given parameter" however when i debug.print the query and run in ms access it works fine,
below is the query, can you help:

qry = "SELECT * FROM Core"
qry1 = qry & " WHERE (((Core.Activity='" & UCase([Forms]![frmReports]![cmbrptactivity]) & "') AND (Core.Unit='" & UCase([Forms]![frmReports]![cmbunit]) & "') AND (Core.Dt_Upload Between #" & [Forms]![frmReports]![txtDate1] & "# And #" & [Forms]![frmReports]![txtDate2] & "#)))"
qry2 = qry1 & " OR (((Core.Activity='" & UCase([Forms]![frmReports]![cmbrptactivity]) & "') AND (([Forms]![frmreports]![cmbunit]) Is Null) AND (Core.Dt_Upload Between #" & [Forms]![frmReports]![txtDate1] & "# And #" & [Forms]![frmReports]![txtDate2] & "#)))"
qry3 = qry2 & " OR ((((Core.Unit)='" & UCase([Forms]![frmReports]![cmbunit]) & "') AND (([Forms]![frmreports]![cmbrptactivity]) Is Null) AND ((Core.Dt_Upload) Between (#" & [Forms]![frmReports]![txtDate1] & "#) And (#" & [Forms]![frmReports]![txtDate2] & "#))))"
qry4 = qry3 & " OR (((([Forms]![frmreports]![cmbunit]) Is Null) AND (([Forms]![frmreports]![cmbrptactivity]) Is Null) AND ((Core.Dt_Upload) Between (#" & [Forms]![frmReports]![txtDate1] & "#) And (#" & [Forms]![frmReports]![txtDate2] & "#))))"

rs.Open qry4, cn, adOpenKeyset, adLockOptimistic
 
Back
Top