Select multiple records from table and archive them

DevAccess

Registered User.
Local time
Today, 00:44
Joined
Jun 27, 2016
Messages
321
Hello,

I have view called approved documents, wherein I have all the approved documents having status called " Approved" as status.

What I would like do is want to select the documents in that table and make the status ="Archived".

I am not sure in table how I can select the record, please assist.
 
Be really careful of your terms. 'View' is a synonym of 'query' in the database world. However, you are posting this in the Form section. Do you mean form or query when you use 'view'?

Second, the way you have written your post, your question logically is this:

"How do I update all the 'Approved' statuses in my table to 'Archived'."

If that's the case, you can run a simple UPDATE query. If not, please demonstrate what you want to occur with data.
 
I would say it is query that holds approved documents , I would like to have option to select recotd/s and archive them.
 
take a look at this link for selecting records in a form

https://www.access-programmers.co.uk/forums/showthread.php?t=289116

then on a button you can split the selectedlist control value and loop through the array doing updates, or use vba create an update query to update them all in one go - along the lines of 'where id in (selectedlist)', ensuring you don't update id 10, 21 etc if you only want to update id 1
 
I would say it is query that holds approved documents , I would like to have option to select recotd/s (sic)and archive them.

Maybe I'm missing something, here, but the Records to be archived have already been 'selected,' have they not? They're the ones with a Status of Approved...correct?

This is akin to the practice of archiving Deleted Records in a separate Table, and the usual response to that is to not archive them in a separate Table, but rather to display them in the appropriate Form(s) using, in this case, the 'Approved' status.

For archived Records you'd filter on the Approved Status using

Code:
Private Sub Form_Open(Cancel As Integer)
    Me.Status.SetFocus
    Me.Filter = "[Status] = 'Approved'"
    Me.FilterOn = True
End Sub
and for all other Records you'd use

Code:
Private Sub Form_Open(Cancel As Integer)
    Me.Status.SetFocus
    Me.Filter = "[Status] <> 'Approved'"
    Me.FilterOn = True
End Sub
Linq ;0)>
 
take a look at this link for selecting records in a form

https://www.access-programmers.co.uk/forums/showthread.php?t=289116

then on a button you can split the selectedlist control value and loop through the array doing updates, or use vba create an update query to update them all in one go - along the lines of 'where id in (selectedlist)', ensuring you don't update id 10, 21 etc if you only want to update id 1

This works but how to select all the records instead of selecting one by one..
 
I assumed you wanted to select some records, not all. If you want all, then you can use the form recordsource plus filter.

If you want to modify the code in the link with a select all button, you'll need a 'select all' button in the form header to loop though the form recordsetclone to populate the 'selectedlist' control with all the ID's
 
I assumed you wanted to select some records, not all. If you want all, then you can use the form recordsource plus filter.

If you want to modify the code in the link with a select all button, you'll need a 'select all' button in the form header to loop though the form recordsetclone to populate the 'selectedlist' control with all the ID's

Actually I needed both they can select what they want plus they can select all if they want..
 
OK - well there are two suggestions to 'select all' in my post - the second one will 'highlight' all the records. The first one you would just get on with the job.
 

Users who are viewing this thread

Back
Top Bottom