Query error

Schillers

Registered User.
Local time
Today, 16:24
Joined
Mar 17, 2012
Messages
23
Code:
SELECT TblFacilityAssetType.[Facility Code]
FROM TblFacilityAssetType
WHERE (((TblFacilityAssetType.[Facility Description])=[Forms]![Booking Facilities].[Facility_Code]));

Access is having none of it and I can't see an issue?

EDIT: Bear in mind that "[Forms]![Booking Facilities].[Facility_Code]" is a Dropdown box if that makes a difference?
 
Last edited:
Define 'not having none of it'?

Error message? No results?

A quick guess without that information is that you are comparing a Facility description to a Facility code.
 
Define 'not having none of it'?

Error message? No results?

A quick guess without that information is that you are comparing a Facility description to a Facility code.

Yeah, no result, if I run the form and then run the query it just opens the datasheet with '(new)' in the field that should display the appropriate code.
 
No results means the query is good, just not producing data that meets your criteria. That means you need to evaluate your criteria:

WHERE TblFacilityAssetType.[Facility Description]=[Forms]![Booking Facilities].[Facility_Code]

Like I said before, this means you are comparing the Form's code to the table's description. Do you mean to do that? Or do you mean to compare the table's code to the form's code?
 
No results means the query is good, just not producing data that meets your criteria. That means you need to evaluate your criteria:

WHERE TblFacilityAssetType.[Facility Description]=[Forms]![Booking Facilities].[Facility_Code]

Like I said before, this means you are comparing the Form's code to the table's description. Do you mean to do that? Or do you mean to compare the table's code to the form's code?

Basically, the box which it is comparing it to pulls its value's from a separate column in the table, this means that that value (Text, not number) needs to be compared to the value in the table to be matched up and displayed again another box? Does that make sense?
 
Not really, but it doesn't need to. Your problem exists in your query, specifically in this portion of your query:

WHERE TblFacilityAssetType.[Facility Description]=[Forms]![Booking Facilities].[Facility_Code]

Whatever value is in the [Facility_Code] field of your form has no matches in the [Facility Description] of your TblFacilityAssetType table which is why your query isn't returning any data.
 

Users who are viewing this thread

Back
Top Bottom