Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Create Select All button on filtered form. 1

Status
Not open for further replies.

mastry

Programmer
Dec 27, 1999
5
US
I have a continuous form based on a table displaying multiple records. One field on the form and in the table is called "select" (Yes/No type). When the form is open the users will use the built in filter functions to filter displayed records. I am trying to create a "select all" function that will update only the filtered records "select" field to Yes. I have the following code in place on the click event, but it updates all of the records in the database to "yes".

How can I just update the records that are currenly displayed on the form?

'Dim dbs As Database
'Dim rst As Recordset
'Dim ys As Boolean
'ys = True
'n = False
'Set dbs = CurrentDb

'Set rst = dbs.OpenRecordset("NEW_CYCLE_MAIN")
' Do Until rst.EOF
' With rst
' .Edit
' !select = ys
' .Update
' rst.MoveNext
'End With
'Loop
'dbs.CLOSE
'Requery

Thanks
 
Hi.

Your open recordset should look more like
'Set rst = dbs.OpenRecordset
("SELECT * FROM NEW_CYCLE_MAIN WHERE filter = condition")

where filter is the field that the form is currently filtered on, and condition is what is selected.

also look at ...WHERE " & me.filter

also readup on me.recordsetclone - this is an already open recordset, duplicating the recordset in the form!!!

There. three ways to attack the problem.

Gzep.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top