Record number not being stored? (1 Viewer)

branston

Registered User.
Local time
Today, 13:05
Joined
Apr 29, 2009
Messages
372
Ok, Hopefully ill be able to get my question understood...

I have a form with a lot of information from a lot of tables. Each record has a unique number - lets call is UniNo. There is a button on the form which creates a new revision by filtering all the tables by UniNo, copying and pasting the record into a temporary table, increasing the revision number by 1, and then appending to the main tables again. So the end result is that the selected UniNo record is up-reved, but all the information is still there in the new rev. The new record is assigned an auto number, and then the form re-freshes and goes to the record with the highest auto number (i.e. the new rev)

This works fine, and has been for ages, but I seem to have a combination of actions which draws an error. I have another button which opens some comments about the record. It is linked on UniNo. If you open this, then close it to return to the main form, then up rev it, it goes through all the sequence, but doesnt actually up rev it. It then also goes to the record with the highest auto number, which was not the record you were looking at.

It seems that its not really registering what record its on, im thinking it might have something to do with the fact that you move off the record, and then come back to it - although im using Me.UniNo as the filter criteria, so surely that should use whatever record is on teh screen??

Any ideas?

Thank you
 

Kempes

Registered User.
Local time
Today, 13:05
Joined
Oct 7, 2004
Messages
327
Off the top of my head, I think it may be because your form had lost it's focus.
Maybe by adding some code to set focus back to this form, then for good measure do a

me.refresh
me.requery


then try the button again.

you may also want to slip in

form_yourform.filteron = true

if that doesn't work.
 

branston

Registered User.
Local time
Today, 13:05
Joined
Apr 29, 2009
Messages
372
Thanks for the reply. I have finally figured it out, and it also solved a lot of other problems i was having. What i needed to do was actually close the 1st form once the 2nd form was open, and then re-open it again when the 2nd form was closed. Access was getting confused with 2 forms from the same query being open at the same time i think, so making sure i only had 1 open at any time seemed to fix a multitude of bugs!

Thanks!
 

Users who are viewing this thread

Top Bottom