SQL Returns No Value

D

DS

I have this SQL statement, It doesn't return an error but it doesn't
return a value either. Its based on 2 tables PCenter and Sales, they
are joined on PCenter.TableID ans Sales.TableNumber...I need to get
the...TableNumber, CName and the SalesID
Thanks,
Any help appreciated.
DS




With Me.ListDineIN
.RowSource = _
"SELECT Sales.TableNumber,Sales.SalesID " & _
"Val(IIf([SepCheck]=True,[Old] & "" & [SepName],[TableName]))
AS CName " & _
"FROM PCenter " & _
"INNER JOIN Sales " & _
"ON PCenter.TableID = Sales.TableNumber " & _
"WHERE Sales.Paid = 0 " & _
"And Sales.Cancelled = 0 " & _
"And PCenter.TInUse=-1 " & _
"And PCenter.Active) = -1 " & _
"ORDER BY Val(IIf([SepCheck]=True,[Old] & "" &
[SepName],[TableName]))"
.ColumnCount = 3
.ColumnWidths = "0;1.5 in;0 in"
.Requery
End With
 
R

Rob Oldfield

Without access to your data I have no idea. But rule 1 (and 2 and probably
3-5) in this situation is...

Drop a breakpoint in.
Grab the SQL
Paste into a query window and see what the problem is.
 
D

DS

Rob said:
Without access to your data I have no idea. But rule 1 (and 2 and probably
3-5) in this situation is...

Drop a breakpoint in.
Grab the SQL
Paste into a query window and see what the problem is.


I have this SQL statement, It doesn't return an error but it doesn't
return a value either. Its based on 2 tables PCenter and Sales, they
are joined on PCenter.TableID ans Sales.TableNumber...I need to get
the...TableNumber, CName and the SalesID
Thanks,
Any help appreciated.
DS




With Me.ListDineIN
.RowSource = _
"SELECT Sales.TableNumber,Sales.SalesID " & _
"Val(IIf([SepCheck]=True,[Old] & "" & [SepName],[TableName]))
AS CName " & _
"FROM PCenter " & _
"INNER JOIN Sales " & _
"ON PCenter.TableID = Sales.TableNumber " & _
"WHERE Sales.Paid = 0 " & _
"And Sales.Cancelled = 0 " & _
"And PCenter.TInUse=-1 " & _
"And PCenter.Active) = -1 " & _
"ORDER BY Val(IIf([SepCheck]=True,[Old] & "" &
[SepName],[TableName]))"
.ColumnCount = 3
.ColumnWidths = "0;1.5 in;0 in"
.Requery
End With
Found the Problem [Old] & "" & Changed to &' '&

Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL Syntax Problem 4

Top