Select / Deselect records

  • Thread starter Thread starter hughess7
  • Start date Start date
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
 
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
 
Back
Top