PC Review


Reply
Thread Tools Rate Thread

Checkbox in header of continuous forms

 
 
Rich
Guest
Posts: n/a
 
      7th Aug 2008
Hi All,

I have a form that displays a set of records from a parameter form.
Once I have this subset of records, I want to include a checkbox in the
form header to check or uncheck all records displayed for a field that
is a checkbox in each record.

I tried an update query, but it only gets the selected record. This
seems fairly easy (as MS uses this in hotmail to select/deselect
messages to delete or move), but can't seem to quite get my head around it.

Any help is greatly appreciated.

Thanks,
RJC
 
Reply With Quote
 
 
 
 
Ken Sheridan
Guest
Posts: n/a
 
      7th Aug 2008
The update query should be restricted by referencing the same parameters as
the form's underlying query, so you'll need to keep the dialogue form open
(it can be hidden), and update the relevant column to the value of the
unbound checkbox in your bound form by referencing it as the 'update to'
parameter.

Call the update query in the unbound check box's AfterUpdate event
procedure. You should ensure than there are no records currently locked by
your form by putting the following in the check box's AfterUpdate event
procedure:

Me.Dirty = False

before calling the update query, though in a multi-user environment another
user could have locked one of the records of course.

The bound form should automatically refresh, but if not you can explicitly
do so with:

Me.Refresh

after calling the update query.

Ken Sheridan
Stafford, England

"Rich" wrote:

> Hi All,
>
> I have a form that displays a set of records from a parameter form.
> Once I have this subset of records, I want to include a checkbox in the
> form header to check or uncheck all records displayed for a field that
> is a checkbox in each record.
>
> I tried an update query, but it only gets the selected record. This
> seems fairly easy (as MS uses this in hotmail to select/deselect
> messages to delete or move), but can't seem to quite get my head around it.
>
> Any help is greatly appreciated.
>
> Thanks,
> RJC
>


 
Reply With Quote
 
 
 
 
Rich
Guest
Posts: n/a
 
      7th Aug 2008
Ken, Thanks for the reply...

My form records are filtered by a Criteria string that I create (via
code) and applied to the form when opened. I didn't see that option
when using the Open.Query command otherwise I would have used it.

Running the update Query (via the on click event of the header checkbox)
only updates the current record on the form (the one that has focus), so
it is getting to that point, but not to any other records.

I did get around it (although not the best way) by using the With
Me.Recordset command and moving the value of the header checkbox into
the record checkbox to update it.

This does what I wanted, but it isn't as "smooth" as the update query
would be. I'm not dealing with a lot of records, so it doesn't impact
the speed that much, but I am still curious as how to do this the other way.

Thanks,
Rich.


Ken Sheridan wrote:
> The update query should be restricted by referencing the same parameters as
> the form's underlying query, so you'll need to keep the dialogue form open
> (it can be hidden), and update the relevant column to the value of the
> unbound checkbox in your bound form by referencing it as the 'update to'
> parameter.
>
> Call the update query in the unbound check box's AfterUpdate event
> procedure. You should ensure than there are no records currently locked by
> your form by putting the following in the check box's AfterUpdate event
> procedure:
>
> Me.Dirty = False
>
> before calling the update query, though in a multi-user environment another
> user could have locked one of the records of course.
>
> The bound form should automatically refresh, but if not you can explicitly
> do so with:
>
> Me.Refresh
>
> after calling the update query.
>
> Ken Sheridan
> Stafford, England
>
> "Rich" wrote:
>
>> Hi All,
>>
>> I have a form that displays a set of records from a parameter form.
>> Once I have this subset of records, I want to include a checkbox in the
>> form header to check or uncheck all records displayed for a field that
>> is a checkbox in each record.
>>
>> I tried an update query, but it only gets the selected record. This
>> seems fairly easy (as MS uses this in hotmail to select/deselect
>> messages to delete or move), but can't seem to quite get my head around it.
>>
>> Any help is greatly appreciated.
>>
>> Thanks,
>> RJC
>>

>

 
Reply With Quote
 
Ken Sheridan
Guest
Posts: n/a
 
      7th Aug 2008
In that case execute the SQL statement in code rather than calling a saved
update query. You can concatenate the string into the SQL statement's WHERE
clause. You can either call the RunSQL method of the DoCmd object, or the
Execute method in DAO or ADO.

Ken Sheridan
Stafford, England

"Rich" wrote:

> Ken, Thanks for the reply...
>
> My form records are filtered by a Criteria string that I create (via
> code) and applied to the form when opened. I didn't see that option
> when using the Open.Query command otherwise I would have used it.
>
> Running the update Query (via the on click event of the header checkbox)
> only updates the current record on the form (the one that has focus), so
> it is getting to that point, but not to any other records.
>
> I did get around it (although not the best way) by using the With
> Me.Recordset command and moving the value of the header checkbox into
> the record checkbox to update it.
>
> This does what I wanted, but it isn't as "smooth" as the update query
> would be. I'm not dealing with a lot of records, so it doesn't impact
> the speed that much, but I am still curious as how to do this the other way.
>
> Thanks,
> Rich.
>
>
> Ken Sheridan wrote:
> > The update query should be restricted by referencing the same parameters as
> > the form's underlying query, so you'll need to keep the dialogue form open
> > (it can be hidden), and update the relevant column to the value of the
> > unbound checkbox in your bound form by referencing it as the 'update to'
> > parameter.
> >
> > Call the update query in the unbound check box's AfterUpdate event
> > procedure. You should ensure than there are no records currently locked by
> > your form by putting the following in the check box's AfterUpdate event
> > procedure:
> >
> > Me.Dirty = False
> >
> > before calling the update query, though in a multi-user environment another
> > user could have locked one of the records of course.
> >
> > The bound form should automatically refresh, but if not you can explicitly
> > do so with:
> >
> > Me.Refresh
> >
> > after calling the update query.
> >
> > Ken Sheridan
> > Stafford, England
> >
> > "Rich" wrote:
> >
> >> Hi All,
> >>
> >> I have a form that displays a set of records from a parameter form.
> >> Once I have this subset of records, I want to include a checkbox in the
> >> form header to check or uncheck all records displayed for a field that
> >> is a checkbox in each record.
> >>
> >> I tried an update query, but it only gets the selected record. This
> >> seems fairly easy (as MS uses this in hotmail to select/deselect
> >> messages to delete or move), but can't seem to quite get my head around it.
> >>
> >> Any help is greatly appreciated.
> >>
> >> Thanks,
> >> RJC
> >>

> >

>


 
Reply With Quote
 
Rich
Guest
Posts: n/a
 
      8th Aug 2008
I will give it a try. Thanks for the assistance.

Rich.

Ken Sheridan wrote:
> In that case execute the SQL statement in code rather than calling a saved
> update query. You can concatenate the string into the SQL statement's WHERE
> clause. You can either call the RunSQL method of the DoCmd object, or the
> Execute method in DAO or ADO.
>
> Ken Sheridan
> Stafford, England
>
> "Rich" wrote:
>
>> Ken, Thanks for the reply...
>>
>> My form records are filtered by a Criteria string that I create (via
>> code) and applied to the form when opened. I didn't see that option
>> when using the Open.Query command otherwise I would have used it.
>>
>> Running the update Query (via the on click event of the header checkbox)
>> only updates the current record on the form (the one that has focus), so
>> it is getting to that point, but not to any other records.
>>
>> I did get around it (although not the best way) by using the With
>> Me.Recordset command and moving the value of the header checkbox into
>> the record checkbox to update it.
>>
>> This does what I wanted, but it isn't as "smooth" as the update query
>> would be. I'm not dealing with a lot of records, so it doesn't impact
>> the speed that much, but I am still curious as how to do this the other way.
>>
>> Thanks,
>> Rich.
>>
>>
>> Ken Sheridan wrote:
>>> The update query should be restricted by referencing the same parameters as
>>> the form's underlying query, so you'll need to keep the dialogue form open
>>> (it can be hidden), and update the relevant column to the value of the
>>> unbound checkbox in your bound form by referencing it as the 'update to'
>>> parameter.
>>>
>>> Call the update query in the unbound check box's AfterUpdate event
>>> procedure. You should ensure than there are no records currently locked by
>>> your form by putting the following in the check box's AfterUpdate event
>>> procedure:
>>>
>>> Me.Dirty = False
>>>
>>> before calling the update query, though in a multi-user environment another
>>> user could have locked one of the records of course.
>>>
>>> The bound form should automatically refresh, but if not you can explicitly
>>> do so with:
>>>
>>> Me.Refresh
>>>
>>> after calling the update query.
>>>
>>> Ken Sheridan
>>> Stafford, England
>>>
>>> "Rich" wrote:
>>>
>>>> Hi All,
>>>>
>>>> I have a form that displays a set of records from a parameter form.
>>>> Once I have this subset of records, I want to include a checkbox in the
>>>> form header to check or uncheck all records displayed for a field that
>>>> is a checkbox in each record.
>>>>
>>>> I tried an update query, but it only gets the selected record. This
>>>> seems fairly easy (as MS uses this in hotmail to select/deselect
>>>> messages to delete or move), but can't seem to quite get my head around it.
>>>>
>>>> Any help is greatly appreciated.
>>>>
>>>> Thanks,
>>>> RJC
>>>>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox in header of continuous forms Rich Microsoft Access Queries 4 8th Aug 2008 02:52 PM
Checkbox tally on Continuous Forms robboll Microsoft Access Forms 2 12th Jul 2007 09:35 PM
Make checkbox invisible in continuous forms individually Mesa Microsoft Access Form Coding 1 5th Feb 2007 01:50 PM
Master-Detail Datagrid -checkbox (once tick the checkbox, all the child checkbox is ticked) Agnes Microsoft VB .NET 0 16th Aug 2004 11:23 AM
Checkbox on continuous forms =?Utf-8?B?TmVpbCBCZXJrb3dpdHo=?= Microsoft Access Form Coding 2 11th Jun 2004 08:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:43 PM.