Highlight selected record in subform.

G

Guest

I have a button on a form that contains a subform. The subform displays
continuous forms with only one field displayed. It doesn't have have record
selectors displayed (I've made it appear like a combo box) When I click on
the field in the subform I would like the whole field to appear highlighted.
Is this possible? Also is it possible to be able to select multiple records
using the Shift or Ctrl key. After the records have been selected I will
click a button to delete the selected records.
Also, when I have not selected a record in the subform and I click my delete
record button the top record is deleted. Why would this be happening? I have
tried:
If IsNull([Forms]![MyForm]![MySubForm]![MyRecordID]) then
Exit sub
but the first records ID is always returned.Any help would be greatly
appreciated. Thanks!
 
T

tina

comments inline.

Greg said:
I have a button on a form that contains a subform. The subform displays
continuous forms with only one field displayed. It doesn't have have record
selectors displayed (I've made it appear like a combo box) When I click on
the field in the subform I would like the whole field to appear highlighted.
Is this possible?

if you're using A2000 or newer, you might try using conditional formatting
to change the background color of the control in the current record.
Also is it possible to be able to select multiple records
using the Shift or Ctrl key.

not directly. this is a form, not a list box, and only one record on a form
can be the Current record at any given point in time. you could add a
DeleteMe field to the underlying table, with a data type of Yes/No. then, in
the subform, some action - perhaps a double click in that single control -
could be used to toggle the DeleteMe field between Yes and No. all records
WHERE DeleteMe = True could then be deleted with a Delete query.
After the records have been selected I will
click a button to delete the selected records.
Also, when I have not selected a record in the subform and I click my delete
record button the top record is deleted. Why would this be happening?

because a form with a RecordSource always has a Current record - when the
form (or subform) opens, usually it's the first record, unless the focus is
programmatically moved to another specific record (or to NewRecord).

hth

I have
tried:
If IsNull([Forms]![MyForm]![MySubForm]![MyRecordID]) then
Exit sub
but the first records ID is always returned.Any help would be greatly
appreciated. Thanks!
 

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