Two Identical Queries...Different outcome

  • Thread starter Thread starter Peggy
  • Start date Start date
P

Peggy

I made a query that included these fields, which all came
from one table. The query ran fine.

CustomerID ChargeID CurrentDue PastDue Balance.

Then I made virtually the same query which came from
another table. The fields were:

CustomerID PayID PayDate PayAmount Balance

When I run this query it always returns '0' for CustomerID
when I view it in datasheet view.

I have customers entered on the forms. Each of these
queries is used for subforms on a form. What ever this
problem is I assume it is also the reason why entries in
the Payment subform don't 'stay' after I enter them. When
I return to this form the subform is empty.
 
It'll help troubleshooting if you post the SQL statements of both queries.
We can't see what you've created. Also include information about how the
tables are structured and may be related.
 
-----Original Message----
This works fine

SELECT [tblCharges].[ChargeID], [tblCharges].[CustID],
[tblCharges].[Service Date], [tblCharges].[Charges],
[tblCharges].[Past Due], [Charges]+[Past Due] AS [Current
Due]
FROM tblCharges;

This doesn't

SELECT tblPayment.CustID, tblPayment.PayID, tblPayment.
[Pay Date], tblPayment.[Current Due], tblPayment.[Pay
Amount], [Current Due]-[Pay Amount] AS Balance
FROM tblPayment;

Funny. I look at them and they don't look the same. SQL
view scares Newbies. We never look at it.

Both tables have a one-to-many relationship with the
table 'Customers' joined on CustID



-
 
-----Original Message-----
Hello. I just checked my relationships. I think there was
a problem there. I corrected it and now my subform seems
to be working.


This works fine

SELECT [tblCharges].[ChargeID], [tblCharges].[CustID],
[tblCharges].[Service Date], [tblCharges].[Charges],
[tblCharges].[Past Due], [Charges]+[Past Due] AS [Current
Due]
FROM tblCharges;

This doesn't

SELECT tblPayment.CustID, tblPayment.PayID, tblPayment.
[Pay Date], tblPayment.[Current Due], tblPayment.[Pay
Amount], [Current Due]-[Pay Amount] AS Balance
FROM tblPayment;

Funny. I look at them and they don't look the same. SQL
view scares Newbies. We never look at it.

Both tables have a one-to-many relationship with the
table 'Customers' joined on CustID



-
It'll help troubleshooting if you post the SQL
statements
of both queries.
We can't see what you've created. Also include information about how the
tables are structured and may be related.

--
Ken Snell
<MS ACCESS MVP>




.
.
 
Back
Top