I have frmEdgeReport which uses ratio buttons to populate the
multiselect listbox .. this all works.. now i need to add date ranges and
everything I do seems to screw up what I already have working..
I have added two textboxes - txtStartDate and txtEndDate. Is anyone able to teach me how to do this?
Not clear what you are asking. Would have to see the dB.
Currently I am getting error when i put the SELECT statement in its own query that says "Invalid SQL Statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', OR 'UPDATE'."
This error usually means that you tried to open a SELECT query using "Docmd.RunSQL" or "Currentdb.Execute".
"Docmd.RunSQL" or "Currentdb.Execute" can only be used for action queries. (ie 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', OR 'UPDATE' queries)
and when I just run my form I am getting an errror that says "Error 3142 - Characters found after end of SQL statement"
This one is easy.
The semi-colon ( ; ) is the line terminator in SQL.
When you create the SQL for the variable "strSelect", there is a semi-colon after the hash (date delimiter).
Code:
WHERE tblEdge.[Calendar Date] >= #" & Forms![frmEdgeReport]![txtStartDate] & "# AND tblEdge.[Calendar Date]<= #" & Forms![frmEdgeReport]![txtEndDate] & "#;"
Then, lower in the code you have
Code:
Select Case fraEdgeTeam.value
Case 0
strDoc = strSelect & " WHERE " & strWhere & " AND tblEdge.Team = 'Team1'"
Case 1
strDoc = strSelect & " WHERE " & strWhere & " AND tblEdge.Team = 'Team2'"
<snip>
Here you are concantation the string "strSelect" (which has the semi-colon terminator) with the string "WHERE", the string "strWHERE" and more text.
So there are two issues here: the SQL terminator ( ; ) and multiple "WHERE" clauses for Cases 0 - 2.
If you put a "Debug.Print" statement after the "End Select" statement, you will see the semi-colon terminator and the multiple "WHERE" statements.