Hi all
I’m struggling on building a working report that filters out based on a calculated field. Access believes this to be because the calculation is too complicated. I will try and explain why (apologies for the length of this).
The data is populated based on a customer table which includes the fields customer number (numeric), agency number (numeric) and owner (text). Both customer number and owner are required fields, but agency number is not. The agency number and customer number could be the same (the agency could also be a customer). I have used Dlookup to populate a calculated field called agencyowner into the query.
Agencyowner: DLookUp("Owner","tbl_Customers","Customernumber = " & [Agency Number])
This is because each customer under the agency can have a different owner, but I need them to group under the agency owner. When I run the query I can see that the AgencyOwner field is giving the correct results.
When I use a the ‘stLinkCriteria’ from the event, it comes up with a message ‘this expression is typed incorrectly, or is too complex to be evaluated’.
The expression is
stDocName = "Rpt_Agency_Summ"
stLinkCriteria = "[AgencyOwner]=" & "'" & [Forms]![Menu]![CbxCC] & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
CbxCC is a combo box with the list of Owner names.
The next thing I tried was to link the criteria of the query to the form control, but this resulted in a similar problem. I don’t want to create a new table or extra fields if I can help it as there’s a lot of records to update and it would confuse the people having to maintain the database. It there another option I haven’t considered.
I’m struggling on building a working report that filters out based on a calculated field. Access believes this to be because the calculation is too complicated. I will try and explain why (apologies for the length of this).
The data is populated based on a customer table which includes the fields customer number (numeric), agency number (numeric) and owner (text). Both customer number and owner are required fields, but agency number is not. The agency number and customer number could be the same (the agency could also be a customer). I have used Dlookup to populate a calculated field called agencyowner into the query.
Agencyowner: DLookUp("Owner","tbl_Customers","Customernumber = " & [Agency Number])
This is because each customer under the agency can have a different owner, but I need them to group under the agency owner. When I run the query I can see that the AgencyOwner field is giving the correct results.
When I use a the ‘stLinkCriteria’ from the event, it comes up with a message ‘this expression is typed incorrectly, or is too complex to be evaluated’.
The expression is
stDocName = "Rpt_Agency_Summ"
stLinkCriteria = "[AgencyOwner]=" & "'" & [Forms]![Menu]![CbxCC] & "'"
'DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
CbxCC is a combo box with the list of Owner names.
The next thing I tried was to link the criteria of the query to the form control, but this resulted in a similar problem. I don’t want to create a new table or extra fields if I can help it as there’s a lot of records to update and it would confuse the people having to maintain the database. It there another option I haven’t considered.