Thanks markros. I tried that and it worked too. You're right, I could have caught that if I'd looked at it closer. And you didn't make me feel like I was being yelled at.
Thank you so much gmmastros!! It worked!!!!!! Thank you sooooooo much. I found some code on the internet that said to use an Inner Join but I still couldn't get it right.
Thanks for your help!!!
To bborissov
I was NOT trying to code it according to just one row being affected. I was trying to explain that I think that's what my code was doing but NOT what I wanted. All I wanted it to do is update the count in the rm table after ANY change is made to the em table.
I tried your code...
...UPDATE, DELETE
AS
Update rm
set rm.count_em = A.EmployeeCount
From rm
Inner Join (
Select em.bl_id, em.fl_id, em.rm_id, Count(*) As EmployeeCount
From em
Group By em.bl_id, em.fl_id, em.rm_id
) As A
On em.bl_id = rm.bl_id...
We have a field in the rm (room) table that counts how many employees occupy the room according to the em (employee) table.
We want to create a trigger to update the rm.count_em field when a change is made to the em (employee) table.
It also uses the bl (building) field, fl (floor) field to...
I hope this will make sense. I'll do the best I can to explain what I'm trying to do. I have a report that is not returning the results the way I want it to. This is how I want it to display:
Site Code Site Name
SENIOR_CTR Senior Center
Property Code Property...
We are using Archibus Web Central.
I got it working. I don't know if it was the SQL statement changes or the changes to the other code but all of a sudden it works.
Thank you for your efforts.
Unfortunately I can't do either one because it is being done in an existing application that already had the tables created. Making changes to the table would be a nightmare. I agree that it would be a lot better if the names were better but I don't have any choice in the matter. We also...
I have several fields in multiple tables that have the same name so I have to use alias's. I have changed the code so many times and keep getting errors either from the alias's, the grouping or the key fields.
This is the latest code:
SELECT rmpctsum.bl_id, rmpctsum.dv_id, bl.bl_id...
I've been playing with it and now I get it to read the date but it's not quite right. I'm using an alert popup box so that I can see the date the it is using. Here is the code:
var myDate = new Date();
myDate.setDate(myDate.getDate()-160);
var myNewDate =...
I have a date that is in a form that is retrieved from the database and I need to check the date and see if it is more than 6 months old and if it is, make the row red. However the only way I can get it to work is if I use "innerHTML" and hardcode the date. I'm trying to find the code that...
Thank you for all of the references. I will read up on everything.
I added a "right join" and that's what got it to work.
No wonder it didn't work if it was doing a cross join and creating so many records.
I made a mistake in my original post. It didn't work in Access 2003 but it worked...
Thanks for everyone's help. I am new at using Access and trying to run it through SQL is definitely challenging. I will definitely take all of your advice into consideration.
After seeing qmmastros comment about the JOIN I decided to try adding the JOIN back in that was once there and it...
No, it's not working since I changed the DISTINCTROW to DISTINCT. I still have the problem.
I have form fields in other queries and they work OK so that's not the problem. I will look and see if any of them are using IIF.
Looking at the history of the query there was a JOIN at one time but...
I have a query that we use in Access 97 and upgraded to Access 2003 and works fine. Now we want to run them using a SQL database but an Access 2003 frontend. When I open the new query in Access 2003 it takes close to an hour to run but when I run the same query in the Access 2003 database, it...
I'm sorry. Your code did work when I put it elsewhere in my code. It just didn't work where I have a loop so I will have to adjust the code. Thank you for your help.
I think the best way to do this is to have code that will count how many characters there are from the left to the first "/". If there is only one character, add a "0". Then repeat to the next "/".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.