W
W Dean
Hi,
I've written the following query which seems to work fine:
UPDATE Calender, (SELECT AccessLevel FROM Users WHERE (UserName =
[aUserName])) AS U1
SET
Calender.Approved = ((U1.AccessLevel = 1) AND ([aApproved]))
WHERE
(Calender.CalenderID = [aCalenderID])
AND
(
(Calender.UserName = [aUserName]) OR
(EXISTS(SELECT Users.UserName FROM Users WHERE
(Users.UserName=[aUserName]) AND (Users.AccessLevel=1)))
);
but after saving it and then reopening it, Access has changed the syntax:
replacing (SELECT AccessLevel FROM Users WHERE (UserName = [aUserName])) AS
U1 with [SELECT AccessLevel FROM Users WHERE (UserName = [aUserName])]. AS
U1 which causes a syntax error. Although if I just run the query without
opening it, it works fine.
Anybody know why? Is there a way to format the query so it doesn't happen.
W Dean
I've written the following query which seems to work fine:
UPDATE Calender, (SELECT AccessLevel FROM Users WHERE (UserName =
[aUserName])) AS U1
SET
Calender.Approved = ((U1.AccessLevel = 1) AND ([aApproved]))
WHERE
(Calender.CalenderID = [aCalenderID])
AND
(
(Calender.UserName = [aUserName]) OR
(EXISTS(SELECT Users.UserName FROM Users WHERE
(Users.UserName=[aUserName]) AND (Users.AccessLevel=1)))
);
but after saving it and then reopening it, Access has changed the syntax:
replacing (SELECT AccessLevel FROM Users WHERE (UserName = [aUserName])) AS
U1 with [SELECT AccessLevel FROM Users WHERE (UserName = [aUserName])]. AS
U1 which causes a syntax error. Although if I just run the query without
opening it, it works fine.
Anybody know why? Is there a way to format the query so it doesn't happen.
W Dean