SteveNapper
Technical User
Thanks for the help yesterday guys and girls. I have a few more questions though.
This question about the WHERE clause
I am using the following code with four combo boxes and it works brilliantly, now you told me what most of it means! I can use any combination of the 1st three fine. The fourth one works if only it is used, i.e. not null. If I use another combo box with it, i.e. look up records that satisfy two requirements, it shows everything, as if all boxes are null. Can you tell me why?
Also, brackets? Why do some start with two, and end with three or four? Can you explain the rule to me?
SELECT [Complexity].[ComplexityName], [Materials].[MaterialName], [Object].[ObjectName], [Process].[ProcessName], [Job].[Time], [Job].[Quantity]
FROM Process INNER JOIN ([Object] INNER JOIN (Materials INNER JOIN (Complexity INNER JOIN Job ON [Complexity].[ComplexityID]=[Job].[ComplexityID]) ON [Materials].[MaterialsID]=[Job].[MaterialsID]) ON [Object].[ObjectID]=[Job].[ObjectID]) ON [Process].[ProcessID]=[Job].[ProcessID]
WHERE ((([Complexity].[ComplexityName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Complexity]),[ComplexityName],[Forms]![JobQueryLookUp]![Complexity]))) And (([Materials].[MaterialName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Material]),[MaterialName],[Forms]![JobQueryLookUp]![Material]))) And (([Object].[ObjectName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Object]),[ObjectName],[Forms]![JobQueryLookUp]![Object]))) And (([Process].[ProcessName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Process]),[ProcessName],[Forms]![JobQueryLookUp]![Process]))));
This question about the FROM clause:
FROM Process INNER JOIN ([Object] INNER JOIN (Materials INNER JOIN (Complexity INNER JOIN Job ON [Complexity].[ComplexityID]=[Job].[ComplexityID]) ON [Materials].[MaterialsID]=[Job].[MaterialsID]) ON [Object].[ObjectID]=[Job].[ObjectID]) ON [Process].[ProcessID]=[Job].[ProcessID]
Are the ( before [Object] INNER JOIN AND Materials INNER JOIN, a bit like , in normal text list? I take it then that ON [Complexity]. etc describes the join. Just why is the ON the opposite order to the 1st part of the list? Is this standard SQL or Access specific, or doesn't it matter?
I ask, because I need to make this thing web based in the near future and am looking at using XML or Java to create forms to suit.
Thanks again and sorry it's so long.
Steve
NB
I am posting this in the correct forum aren't I? I've posted it here because it's do with the forms element of access.
This question about the WHERE clause
I am using the following code with four combo boxes and it works brilliantly, now you told me what most of it means! I can use any combination of the 1st three fine. The fourth one works if only it is used, i.e. not null. If I use another combo box with it, i.e. look up records that satisfy two requirements, it shows everything, as if all boxes are null. Can you tell me why?
Also, brackets? Why do some start with two, and end with three or four? Can you explain the rule to me?
SELECT [Complexity].[ComplexityName], [Materials].[MaterialName], [Object].[ObjectName], [Process].[ProcessName], [Job].[Time], [Job].[Quantity]
FROM Process INNER JOIN ([Object] INNER JOIN (Materials INNER JOIN (Complexity INNER JOIN Job ON [Complexity].[ComplexityID]=[Job].[ComplexityID]) ON [Materials].[MaterialsID]=[Job].[MaterialsID]) ON [Object].[ObjectID]=[Job].[ObjectID]) ON [Process].[ProcessID]=[Job].[ProcessID]
WHERE ((([Complexity].[ComplexityName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Complexity]),[ComplexityName],[Forms]![JobQueryLookUp]![Complexity]))) And (([Materials].[MaterialName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Material]),[MaterialName],[Forms]![JobQueryLookUp]![Material]))) And (([Object].[ObjectName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Object]),[ObjectName],[Forms]![JobQueryLookUp]![Object]))) And (([Process].[ProcessName])=(IIf(IsNull([Forms]![JobQueryLookUp]![Process]),[ProcessName],[Forms]![JobQueryLookUp]![Process]))));
This question about the FROM clause:
FROM Process INNER JOIN ([Object] INNER JOIN (Materials INNER JOIN (Complexity INNER JOIN Job ON [Complexity].[ComplexityID]=[Job].[ComplexityID]) ON [Materials].[MaterialsID]=[Job].[MaterialsID]) ON [Object].[ObjectID]=[Job].[ObjectID]) ON [Process].[ProcessID]=[Job].[ProcessID]
Are the ( before [Object] INNER JOIN AND Materials INNER JOIN, a bit like , in normal text list? I take it then that ON [Complexity]. etc describes the join. Just why is the ON the opposite order to the 1st part of the list? Is this standard SQL or Access specific, or doesn't it matter?
I ask, because I need to make this thing web based in the near future and am looking at using XML or Java to create forms to suit.
Thanks again and sorry it's so long.
Steve
NB
I am posting this in the correct forum aren't I? I've posted it here because it's do with the forms element of access.