Originally Posted by
MykeRuiz
Sir, updating the employee table alone, the code works. but if i add the code to update the status of assigned asset it doesn't work at all.
I think this statement suggests that the code is the same for both situations, when in fact, it is not. In one case, you attempt to loop through a recordset; in the other, you do not. Here are my observations, for whatever they're worth:
1. You should be using Do While...Loop statements in favour of the old While...Wend of BASIC if only for the reasons that you can test conditions within the loop, plus exit the loop when conditions warrant.
2. I think you are assuming that any search is going to start at the beginning of your table because that's what you see in a table view. A recordset has no such guarantee, and without a .Move First, where you will start is a crap shoot. Where you will go by using = with .Seek is forward from where you are. Do not expect the search to begin at the beginning of the recordset when it reaches the end. Thus if you start past the point where the sought value is found, you will not find it.
3. you are closing the recordsets, but not destroying them (they will continue to occupy system memory). My rule is, anything that gets Set to anything gets Set to Nothing before the procedure reaches the end (Set rs = Nothing) and after .Close if that is needed first.
.4 I agree with Paul. This While Not .EOF is outside of the block that references the recordset. You are trying to refer to a property of it (.EOF) without referring to it first. I'm also surprised an error is not presented. Or perhaps it is, which leads me to #5...
.5 Doesn't work doesn't help (liking that one so much it is part of my signature). Your original post should have at least stated what happens and what (if any) error messages are encountered. Anything beyond that minimum, such as what calls a procedure, what it should do (it is seldom obvious to us what a poster has in their head) which line it fails on (when errors are encountered), the error number and text - is a bonus and can only help us to help you.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.