Combo box

Copper Contributor

Good day I have a table with data, and I am trying to run a query with the criteria from a combo box. 

When I run the query I get no data. I don't know how to figure out what's wrong.  Also I don't know how to access my post, as I posted this last week.

Thanks

Cristina

6 Replies

@CristinaRSP 

I think you can go to your profile and obtain a list of all previous posts you have made, but of all the forums I frequent, this is easily the least intuitive to navigate.

 

With regard to your question, asking in such generic terms makes it impossible for anyone to guess what the specific problem could be. If you were to offer specifics, such as the SQL of the query (not a screenshot of the query design grid, but the actual SQL) and some sample data that SHOULD return values, maybe someone would then be able to help identify potential reasons for the problem.

Thanks for your response.
This is the SQL.
SELECT DISTINCT RTI.[Cause of Accident], RTI.full_name, RTI.sex
FROM RTI
WHERE (((RTI.[Cause of Accident])=[Forms]![Preview Reports]![Combo100]));
I have a table with list of causes of accidents, and a table with Data on crashes.
The query returns no data.
I would be grateful for your assistance.

Cristina
full_name sex Cause of Accident
John green Male Loss of Control
Susiw Wong Female Driver's Negligence
Jack Sprat Male DUI
This is a sample of the data. The list of causes is in a table "TBLCauseofaccident

@CristinaRSP 

 

What is the rowsource for the combo box, [Forms]![Preview Reports]![Combo100]

 

And we try to rename controls instead of accepting the default assigned by Access, "Combo100" apparently is based on a lookup table of accident causes, so give it that name: "cboAccidentCause" or similar.

 

My guess is that there is probably a number field involved, and not just the text field indicated, but we have to see that as well.

Thank you. I renamed the Combo Box and removed the ID auto number from the source table of the combo box, (TblCauseofaccident)and it worked. Thank you very much
That's the opposite of what I would have suggested, unfortunately. The reason for the two columns in a lookup table is that the ID, which is the Primary Key for the table, is unique and never changes. The text value, on the other hand, can be altered. The way you have it now, if you decide that "DUI", for example, should be "DWUI" (driving while under the influence) you'll suddenly have two different values that ostensibly mean the same thing.

What I meant when I said, "...we have to see that as well", was that you'd share that with us so we could give you more specific suggestions.