Share via

No valid fields can be found when using a crosstab query for a listbox in Access

Anonymous
2023-08-19T18:55:33+00:00

When I create a crosstab query and run it, I get the results that I'm looking for in a datasheet view. However, when I try to add a listbox to my form and then use that crosstab query, I get a pop-up every time "No valid fields can be found in [crosstab_query_name]. Please select a new source."

Here is my SQL:

PARAMETERS Forms![Home]![cmbChallenge].[Value] Short;

TRANSFORM Sum(-1*(1-(Round(b.WEIGHT/a.WEIGHT,4)))) AS SumOfWEIGHT

SELECT a.NAME

FROM (SELECT p.F_NAME & " " & p.L_NAME AS NAME, w.WEIGHT, p.ID FROM Participant AS p INNER JOIN Weight AS w ON p.ID = w.PART_ID WHERE (((w.INITIAL_WEIGH_IN)=True) And ((w.CHAL_ID)=Forms![Home]![cmbChallenge].Value))) AS a INNER JOIN (SELECT Weight.PART_ID, Weight.CHAL_ID, Weight.WEIGHT, Weight.WEIGH_IN_DATE FROM Weight WHERE (((Weight.INITIAL_WEIGH_IN)=False AND Weight.CHAL_ID = Forms![Home]![cmbChallenge].Value))) AS b ON a.ID = b.PART_ID

GROUP BY a.NAME

PIVOT b.WEIGH_IN_DATE;

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2023-08-19T21:13:25+00:00

That's not correct, @Scott. Here is a listbox bound to a crosstab.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2023-08-20T23:42:45+00:00

    That's not correct, @Scott. Here is a listbox bound to a crosstab.

    I found the sql is not a parameter query from below image
    Image

    PARAMETERS Forms![Home]![cmbChallenge].[Value] Short;

    This is a parameter query.

    I guess they are different at this point.

    Was this answer helpful?

    0 comments No comments
  2. Duane Hookom 26,825 Reputation points Volunteer Moderator
    2023-08-20T11:47:32+00:00

    As Tom’s reply shows, he has filled the Column Headings property of the crosstab. There are a few uses of a crosstab that require this.

    Was this answer helpful?

    0 comments No comments
  3. ScottGem 68,830 Reputation points Volunteer Moderator
    2023-08-19T23:02:11+00:00

    My bad

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2023-08-19T19:52:59+00:00

    You can't use an aggregate query as a Rowsource for a listbox. There is no unique value to select.

    Was this answer helpful?

    0 comments No comments