Stang70Fastback
Registered User.
- Local time
- Today, 16:37
- Joined
- Dec 24, 2012
- Messages
- 132
So I have the following statement:
Those TempVars (in bold) are defined using the following code before being referenced, and there is no issue with anything. It all works fine.
However, I also have this statement:
In this case, those two TempVars are defined using the following piece of code (X3 in this example):
I realize this is slightly more complex, but I know that the resulting value of the TempVar is EXACTLY what would normally be in the select statement. Every single character is identical, and it worked before. However, in this case, the resulting report seems to ignore this part. You can see here by the "not like" statements that I am attempting to exclude a few records from the result, but they are not excluded, so it makes me think I'm doing something wrong that causes Access to gloss over this last part. I get no errors, but it simply doesn't seem to do anything with the TempVar at all. Does anyone know why this works fine in my first example, but not in my second?
SELECT *
FROM ShiftsBusesSC
WHERE (((ShiftsBusesSC.[Day Of Week])=TempVars!Day) And ((ShiftsBusesSC.Category) In (TempVars!X1,TempVars!X2)) And ((ShiftsBusesSC.[Employee Last Name]) Is Null Or (ShiftsBusesSC.[Employee Last Name])<>"ACCOUNT PENDING"));
Those TempVars (in bold) are defined using the following code before being referenced, and there is no issue with anything. It all works fine.
TempVars.Add "X1", "E"
TempVars.Add "X2", "ETR"
However, I also have this statement:
SELECT ShiftChangeX.[Employee Number], ShiftChangeX.Category, ShiftChangeX.[Shift Description], ShiftChangeX.Date, ShiftChangeX.[Start Time], ShiftChangeX.[End Time], ShiftChangeX.Duration, ShiftChangeX.[Day Of Week], ShiftChangeX.[Employee First Name], ShiftChangeX.[Employee Last Name], ShiftChangeX.Route, ShiftChangeX.Bus FROM ShiftChangeX LEFT JOIN ShiftChangeY ON ShiftChangeX.[Employee Number] = ShiftChangeY.[Employee Number] WHERE (((ShiftChangeY.[Employee Number]) Is Null) AND (TempVars!X3)) UNION SELECT ShiftChangeY.[Employee Number], ShiftChangeY.Category, ShiftChangeY.[Shift Description], ShiftChangeY.Date, ShiftChangeY.[Start Time], ShiftChangeY.[End Time], ShiftChangeY.Duration, ShiftChangeY.[Day Of Week], ShiftChangeY.[Employee First Name], ShiftChangeY.[Employee Last Name], ShiftChangeY.Route, ShiftChangeY.Bus FROM ShiftChangeY LEFT JOIN ShiftChangeX ON ShiftChangeY.[Employee Number] = ShiftChangeX.[Employee Number] WHERE (((ShiftChangeX.[Employee Number]) Is Null) AND (TempVars!Y3));
In this case, those two TempVars are defined using the following piece of code (X3 in this example):
TempVars.Add "X3", "(ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*12E*" & Chr(34) & " And (ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*21E*" & Chr(34) & " And (ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*32E*" & Chr(34) & " And (ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*40E*" & Chr(34) & " And (ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*50E*" & Chr(34) & " And (ShiftChangeX.[Shift Description]) Not Like " & Chr(34) & "*80E*" & Chr(34)
I realize this is slightly more complex, but I know that the resulting value of the TempVar is EXACTLY what would normally be in the select statement. Every single character is identical, and it worked before. However, in this case, the resulting report seems to ignore this part. You can see here by the "not like" statements that I am attempting to exclude a few records from the result, but they are not excluded, so it makes me think I'm doing something wrong that causes Access to gloss over this last part. I get no errors, but it simply doesn't seem to do anything with the TempVar at all. Does anyone know why this works fine in my first example, but not in my second?