a,b,c,d should all be declared the same as rst and db.
What does b do with its new value.
move the a= rst.RecordCount to after the "End With"
after With rst add a .MoveFirst before the MoveLast.
Totally Untested.
Wendor
Are you going to post a cut down version of your Data Base.
It would help us to see the problem more clearly.
I am sure you must have a good reason for not posting if that is the way you want to go.
I believe that you should have all your relationships in place. This will allow you to see a map of what is happening.
If you can't join the tables, it may be because the design of your tables is incorrect. "it start showing me wrong values " This makes me feel that you do have some incorrect...