command button to set yes/no field to no for all records w/todays

G

Guest

I would like to add a command button to the main form that would set a yes/no
field called Notavail to NO for all records in the subfrom and in the main
form (based on a query)back to NO at the End of the day so they are all
available for the next day. There is a date field on the subform. Know to
make a command button and add code to the On click event of the button - not
sure how to set up code to reset value of existing records??

Thanks,
Barb
 
S

strive4peace

Hi Barb,

Use an SQL for an UPDATE query

'~~~~~~~~~~~~~

dim strSQL as string
strSQL = "UPDATE tablename " _
& " SET Notavail = False " _
& " WHERE criteria"
currentdb.execute strSQL

'~~~~~~~~~~~~~

substitute your criteria after the WHERE keyword

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top