BamaColtsFan
Registered User.
- Local time
- Today, 16:41
- Joined
- Nov 8, 2006
- Messages
- 91
I am working on an Access 2007 database. This database links to source data (via linked text files) from another system. One of the fields in the source data may possibly be null. When that condition exists, I want the query to look at another table and return the data from there.
The basic logic is thus: Look at the Timecard Approver in the table PPE I, if it is null, go to the Organization Management Data table and get the Timecard Approver from there based on the Group in PPE I. Otherwise, return the value originally found in PPE I.
The text of the expression I am trying to use is:
Timecard Approver: IIf([PPE I]![Timecard Approver] Is Null,(SELECT [Organization Management Data].[Timecard Approver] FROM [PPE I] INNER JOIN [Organization Management Data] ON [PPE I].Group = [Organization Management Data].[Organization Name] GROUP BY [PPE I].Group, [Organization Management Data].[Timecard Approver]),[PPE I]![Timecard Approver])
The error I get is "At most one record can be returned by this subquery."
So, the question is what am I doing wrong? If a subquery is not the proper method to retrieve the data, what is? Is there another function that might return the needed results? Any advice would be appreciated...
The basic logic is thus: Look at the Timecard Approver in the table PPE I, if it is null, go to the Organization Management Data table and get the Timecard Approver from there based on the Group in PPE I. Otherwise, return the value originally found in PPE I.
The text of the expression I am trying to use is:
Timecard Approver: IIf([PPE I]![Timecard Approver] Is Null,(SELECT [Organization Management Data].[Timecard Approver] FROM [PPE I] INNER JOIN [Organization Management Data] ON [PPE I].Group = [Organization Management Data].[Organization Name] GROUP BY [PPE I].Group, [Organization Management Data].[Timecard Approver]),[PPE I]![Timecard Approver])
The error I get is "At most one record can be returned by this subquery."
So, the question is what am I doing wrong? If a subquery is not the proper method to retrieve the data, what is? Is there another function that might return the needed results? Any advice would be appreciated...