I have a form with 3 combo boxes (TeamNamecbo, CustomerNamecbo and AccountTypecbo).
TeamNamecbo just lists all the teams from Teamtbl
CustomerNamecbo is filtered (for want of a better word) to show only the customers that TeamNamecbo supports using the following.
PasswordRequirements is used to populate a text box on the form.
The 3rd, AccountTypecbo I want to filter on both TeamNamecbo and CustomerNamecbo. I have tried amending the above code logically but can't get it to display.
I'm admittedly not very good at writing my own code and usually have to follow multiple different examples or bastardise other peoples code
Could anyone please give any advice as to why the statement on the 3rd combo box is failing or suggest a better way?
TeamNamecbo just lists all the teams from Teamtbl
CustomerNamecbo is filtered (for want of a better word) to show only the customers that TeamNamecbo supports using the following.
Code:
SELECT distinct Accounts.ID, accounts.CustomerName, Accounts.PasswordRequirements FROM accounts Where (((accounts.TeamName)=[forms]![Checks]![TeamNamecbo])) UNION select distinct null, null, null FROM accounts
ORDER BY accounts.CustomerName;
The 3rd, AccountTypecbo I want to filter on both TeamNamecbo and CustomerNamecbo. I have tried amending the above code logically but can't get it to display.
Code:
SELECT distinct accounts.ID, accounts.AccountType FROM accounts WHERE (((accounts.TeamName)=[forms]![Checks]![TeamNamecbo])) and (((accounts.CustomerName)=[forms]![Checks]![CustomerNamecbo])) UNION select distinct null, null
ORDER BY accounts.accounttype;
I'm admittedly not very good at writing my own code and usually have to follow multiple different examples or bastardise other peoples code
Could anyone please give any advice as to why the statement on the 3rd combo box is failing or suggest a better way?