Update table field using vba based on a query (1 Viewer)

P.Zerbie

New member
Local time
Today, 09:03
Joined
Aug 6, 2012
Messages
3
I hope someone can help me with what I'm sure is a simple solution but I seem to keep failing.

I have a table 'table1' which has various field including an ID field and a yes/no field. I then have a form based on a query originally derived from data in the original table. The form provides a list with some ID's with a yes and some with a no.

I'm trying to write a button code to convert all the no's into yes' for those ID's picked out by the query.

I've searched lots of sites and get that I need to set recordsets for both table1 and the forms' query but all my efforts crash or give an error.

I am looking for the right way to say .." for each ID in form set the yes/no field corresponding to the same ID in table1 to yes"

I'd attach my version but I think its a bit of rubbish.

Many thanks,

Pete
 

Cronk

Registered User.
Local time
Tomorrow, 02:03
Joined
Jul 4, 2013
Messages
2,777
Add another Yes/No field to your table and call it ToBeUpdated.

When you open this form, have an update query to set this to be false for all records.

In your form, tick this box for records to be updated and then run an update query on the records selected.

But first maybe you should clean up your rubbish.
 

Users who are viewing this thread

Top Bottom