Jurgen Welz
jwelz at hotmail.com
Tue Jul 10 09:59:48 CDT 2007
If you use a long for the 'Marked' field, you can assign 32 users a bit position within the long. I've done this to flag users in our office for appointments and meetings. Alternatively you could use a text field with delimited User IDs and query with 'Like *" & UserID & "*', though querying on the bit is more efficient. Hence this needn't necessarily be a bound limitation. In terms of marking a field based on a filtered recordset, I'd be inclined to run a dbExecute rather than iterating a recordset: "Update tblDivision Set Marked = True Where " & Forms("frmDivision").Filter or you could write the Where clause based on the buttons and combos. Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com >From: "jwcolby" <jwcolby at colbyconsulting.com> > >First of all, using a field called "Marked" may cause multi-user issues. >It >definitely will in a bound form, because the records are live linked back >to >the table. If another user clears the marked flag for a record the current >user is looking at... > > >John W. Colby >Colby Consulting > >I have continuous form that is a subform. On the parent form's header are >some buttons and combo boxes that are used to filter the continuous >subform. >This all works fine. There's an option group that contains "Mark All", >"Find >Marked" and "Unmark All" options. When I first wrote it, "Mark All" applied >to all the records in the table but I want it to be smarter than that. To >wit, when you filter, say, by age, and select 20 as the age, then only a >small subset of the total rows are shown. I want "Mark all" to apply to the >subset not the whole table. > >The Marking is done using a column in the table called Marked. The first >version invokes a stored procedure to mark and unmark all the records and >it >is amazingly quick. > >I thought that if I used the recordsetclone it would present only the >filtered subset, but apparently that doesn't work. Here's the code I wrote: > ><code> >Sub MarkAllRecords() > Dim rst As ADODB.Recordset > With Me > Set rst = .Riders_Browser_fsub.Form.RecordsetClone > > Do While Not rst.EOF > rst.Fields("Marked") = -1 > rst.Update > Debug.Print rst("RiderID"), rst("Marked") > rst.MoveNext > Loop > Debug.Print rst.RecordCount & " rows changed." > rst.Close > Set rst = Nothing > End With >End Sub ></code> > >This marks all the records in the table, not the filtered subset. How do I >get a handle on just the subset? I suppose that I could use a SQL statement >that specifies the current filter, which I shall try now, but I'm wondering >why the code above doesn't work -- or rather, how to make it work. > >TIA, >Arthur _________________________________________________________________ New Windows Live Hotmail is here. Upgrade for free and get a better look. www.newhotmail.ca?icid=WLHMENCA150