Select / Deselect records

H

hughess7

Hi all

I have a continuous form which the user can filter on certain criteria,
currently this is done with an option box which changes the recordsource of
the form to a different query. What I now want is to add a selection routine,
so I have stored the data in a table to enable me to add a bound checkbox. I
know I can use code like:

'strSql = "UPDATE MyTable SET MyYesNo = False WHERE Select = True;"
'DBEngine(0)(0).Execute strSql, dbFailOnError

to deselect records for example, but I am not sure how to do this only on
the filtered recordset?

Thanks in advance for any help.
Sue
 
J

Jeanette Cunningham

You change the Where part of the query to add the additional filter
criteria.
Example code

strSql = "UPDATE MyTable SET MyYesNo = False " _
& "WHERE Select = True " _
& "And CustomerID = & " Me.CustomerID & " "_
& "And GroupID = " & Me.GroupID
Debug.Print strSQL
DBEngine(0)(0).Execute strSql, dbFailOnError


Note: replace CustomerID and GroupID with the appropriate objects for your
form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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