NJudson
Who farted?
- Local time
- Today, 18:07
- Joined
- Feb 14, 2002
- Messages
- 297
I was hoping someone may be able to take a look at this at point out what I may possibly be doing wrong. I'm using Access 2000 and I have an event procedure on a form which runs an SQL statement and outputs the results to a listbox on my form. It looks like this:
Me.ListTotals.RowSource = "SELECT top 10 First(Cell) AS [MTX], Count(Cell) AS [Number Of Events], [Month-Day], Switch " & _
"FROM tblMTX160 " & _
"where [Month-Day]= '" & sDATE & "' AND Switch = '" & Me.cboSwitch & "' " & _
"GROUP BY [Month-Day], Switch, Cell " & _
"ORDER BY Count(Cell) DESC;"
Me.Refresh
This works just fine. I then try to creat an event procedure in the double-click for the listbox and wrote an SQL statement like such:
Me.txtFilteredField = MTX
Me.ListTotals.RowSource = "SELECT SWITCH, CELL, VCH, Count(VCH) AS [Number of Events] " & _
"FROM tblMTX160 " & _
"WHERE CELL = '" & MTX & "' " & _
"GROUP SWITCH, VCH, CELL " & _
"ORDER BY Count(VCH) DESC;"
Me.Refresh
When I run this 2nd SQL the listbox appears blank like it found no records that fit the query. I believe that I've narrowed the problem for this doubl-click SQL statement at the "WHERE" part. When I remove the "WHERE" statement then the SQL works and outputs the results to the listbox on the form. The funny thing is the "WHERE" statement is no different(from what I can tell) from any other SQL statements I've used and those work. Can someone tell me if this is the wrong way to write it or if there is another way to write it?
WHERE CELL = '" & MTX & "' " &_
Could this just be one of those unfortunate hickups in the Access dbase. I've been looking and working on this for some time and I think I really need another pair of eyes at this point. Thanks for any help.
[This message has been edited by NJudson (edited 04-25-2002).]
[This message has been edited by NJudson (edited 04-25-2002).]
[This message has been edited by NJudson (edited 04-25-2002).]
Me.ListTotals.RowSource = "SELECT top 10 First(Cell) AS [MTX], Count(Cell) AS [Number Of Events], [Month-Day], Switch " & _
"FROM tblMTX160 " & _
"where [Month-Day]= '" & sDATE & "' AND Switch = '" & Me.cboSwitch & "' " & _
"GROUP BY [Month-Day], Switch, Cell " & _
"ORDER BY Count(Cell) DESC;"
Me.Refresh
This works just fine. I then try to creat an event procedure in the double-click for the listbox and wrote an SQL statement like such:
Me.txtFilteredField = MTX
Me.ListTotals.RowSource = "SELECT SWITCH, CELL, VCH, Count(VCH) AS [Number of Events] " & _
"FROM tblMTX160 " & _
"WHERE CELL = '" & MTX & "' " & _
"GROUP SWITCH, VCH, CELL " & _
"ORDER BY Count(VCH) DESC;"
Me.Refresh
When I run this 2nd SQL the listbox appears blank like it found no records that fit the query. I believe that I've narrowed the problem for this doubl-click SQL statement at the "WHERE" part. When I remove the "WHERE" statement then the SQL works and outputs the results to the listbox on the form. The funny thing is the "WHERE" statement is no different(from what I can tell) from any other SQL statements I've used and those work. Can someone tell me if this is the wrong way to write it or if there is another way to write it?
WHERE CELL = '" & MTX & "' " &_
Could this just be one of those unfortunate hickups in the Access dbase. I've been looking and working on this for some time and I think I really need another pair of eyes at this point. Thanks for any help.
[This message has been edited by NJudson (edited 04-25-2002).]
[This message has been edited by NJudson (edited 04-25-2002).]
[This message has been edited by NJudson (edited 04-25-2002).]