AccessWomble
New member
- Local time
- Today, 03:10
- Joined
- Dec 4, 2009
- Messages
- 3
Hi everyone
Quite new to Access and SQL so this could be something as simple as brackets..
I have tables called:
I want to create an UPDATE query to place the word 'Overdue' in the field tblSections.SectionStatus, for any record for which:
'Data type mismatch in criteria expression'.
The strategy is to count the records in tblActions that are oustanding or null, ensure the count is zero and so on. (The dateDiff part works fine on its own in a simple query, that's not a problem here, although i've been messing around with brackets since then to try and get it to work. )
Thanks for looking!
Quite new to Access and SQL so this could be something as simple as brackets..
I have tables called:
- tblSections, and each record in there 'has' x related records in the table
- tblActions,
I want to create an UPDATE query to place the word 'Overdue' in the field tblSections.SectionStatus, for any record for which:
- tblSections.DateDue is in the past, AND
- Any one of the related records in tblActions has value either 'Outstanding', or Is Null.
'Data type mismatch in criteria expression'.
The strategy is to count the records in tblActions that are oustanding or null, ensure the count is zero and so on. (The dateDiff part works fine on its own in a simple query, that's not a problem here, although i've been messing around with brackets since then to try and get it to work. )
Code:
UPDATE tblSections SET tblSections.SectionStatus = "Overdue"
WHERE (((DateDiff("d",[DateDue],Now()))>0) AND (((SELECT COUNT([tblActions.ActionStatus]) FROM tblActions
WHERE [tblActions.SectionsForeignID] = [tblSections.SectionsID]
AND ([tblActions.ActionStatus] = 'Outstanding' OR [tblActions.ActionStatus] is Null)))=0));
Thanks for looking!