Using check box to make record active

A

AccessIM

Is it possible to use a check box to make a record active?

Here is the issue: I have a form that has several records per employee. On
this form is a check box called "Reprint". This check box is used as
criteria for opening/previewing a report.

When I check the box, I would like the record selector on the far left to
also be selected, making that record the active/current record.

When I click the check box, a pencil shows in the record selector of that
record but it does not make it the active/current record and nothing shows up
on the report.

I have tried running a macro in the AfterUpdate event on the check box to
requery but this always makes the first record on the list the active record.
If I check the box and then manually click the record selector of the
corresponding record, everything works fine but I don't want the user to have
to click both everytime.

Hope this all makes sense. Any suggestions would be appreciated. Thank you!
 
M

Maurice

Is this a continuous form? Is there a checkbox next to every record? Have
your tried setting the focus to a specified field of that record. That should
make it the active record (if the checkbox is on the same recordline)
 
J

Jack Leach

When I check the box, I would like the record selector on the far left to
also be selected, making that record the active/current record.

When I click the check box, a pencil shows in the record selector of that
record but it does not make it the active/current record

When you select any control (a checkbox) in a list of records, that record
is automatically selected. The pencil icon indicates that the record is
being edited... data has changed but not yet saved. So that's done for you
already.

but it does not make it the active/current record and nothing shows up
on the report.

Simply changing the record in a list on a form will not do anything to
filter a report. However, there is a form event called Current that will
fire every time a record is changed. In most cases, you can use this event
to run a requery code for a report (be aware that this will fire when the
form initially opens, and when going to new records: hence, you will have to
do some Null testing (or Me.NewRecord) tests to make sure the data is present
before trying to do anything with it).

I have tried running a macro in the AfterUpdate event on the check box to
requery but this always makes the first record on the list the active record.

This is standard behavior as well... after a requery the cursor usually
starts at the beginning. You will need to capture the current record ID
before requerying, and after the requery use some code to navigate to that
record again.

May I suggest staying away from Macros completely, and doing everything in
VBA... you'll thank yourself later!



If you need help with any of the above, be sure to include more specific
details on the setup you have... the above is based on a generic situation
but anything deeper we will need more info on.

hth


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
A

AccessIM

Thank you for pointing me in the right direction. It took a little while
since I am not too familiar with code but I got it! Thanks for the
information and quick response.
 

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