Okay, now I am lost.
The following code works great for opening the report but if I use the SQL or even the query where would the "Buildwhere (me," Or ")" go?
The below opens the report with the correct dates.
DoCmd.OpenReport "Summary Time and Attendance Register", acViewPreview, , BuildWhere(Me, "OR")
The problem is that on a rather regular basis, I need to delete a day for some reason or another, therefore I was hopeing to use a delete query with the Buildwhere(me,"Or")
The form is set up to allow me to enter upto 4 different date ranges and/or 3 different individual days. (That comes in handy around Holiday season).
Any idea of how to formulate the SQL or Delete Query? Currently there is the "Code" from the query...
I'm assuming BuildWhere(Me, "OR") builds a WHERE string based on your current form.
You can't use the BuildWhere function in the query because (I'm assuming) it's filtering more than one column. Rather, in each field, you'd have to point it to the control of the form. For example, if I have a form frmTest with cboBox1 and cboBox2, and a table tblTest with Field1, Field2, Field3, ... and I want to delete all records where Field1 = cboBox1 and Field2 = cboBox2, then in the Criteria of Field1, I would put Forms!frmTest!cboBox1, and in the Criteria of Field2, I would put Forms!frmTest!cboBox2.
If you want to use your BuildWhere function, you would actually need to do that in VB. So instead of using the DoCmd.OpenQuery, you would use DoCmd.RunSQL "DELETE FROM Test WHERE " & BuildWhere(Me, "OR")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.