Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery tables from unbound form

Status
Not open for further replies.

jimlee

Programmer
Jan 27, 2001
213
GB
I have a 'Maintenance' form in my database with a button called 'Archive All Verified Records' on it.

When you click this, the code goes and looks at 4 tables, Each table has a boolean 'Verified' field. If in any record, Verified = true then that record will be sent to archives.

Can anyone tell me how I can requery the tables before I do this because it is possible that 1 or more users may be using one of the tables when this happens and might have checked a 'Verified' field but not yet updated the table.

I have tried docmd.requery "tableName" but access doesn't like it! :(

I have also searched these posts and tried access help.

Any help much appreciated.


jimlad
 
Your heading says you are using unbound forms so you must be opening recordsets to display the records.
You can issue a rs.requery command in your code when you want to be sure it is up to date but you must rememeber that this will put the rs back to the same point as if you had just opened the rs so you need to move to the first record again.
 
If the other users have any record locks in place you won't be able to force an update from your end. How do you know that they aren't going to uncheck the 'verified' field and then you would end up with data being archived that should not be?
You could code in a a way for the front end to check if you are running your archive and force a requery on each individual front-end, but this seems as though it would introduce unwanted problems because partially entered information may find its way into the database and users would not be able to undo their changes when this occurs. It is just safer to assume (which Access does) that a locked record can and will change.

Hope this helps,
Tom
 
lupins, i'm not displaying the records, just using a button to archive some stuff depending on the verified check being true.

TomHW,

Good point, I think that it would be too dangerous for the reasons you stated, shouldn't be a major problem anyway, I'll leave it as it is.

As usual thanks to everyone for replying

jimlad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top