select row in datasheet view

  • Thread starter Michael S. Montoya
  • Start date
M

Michael S. Montoya

I have a subform which is in Datasheet view. If you are to manually click
on the record selector, all the fields in the entire row are "highlighted"
,or selected. Is there a way to "click" a record selector using vba? What
I do is when the form is opened a certain record if found (findfirst). When
the record is found, the cursor lies in the first field. I would like the
entire row "highligted". I would be willing to use a "conditional
formatting" if needed, but there are alot of fields and would rather not.
After the findfirst event, I tried the docmd.runcommand selectrecord, but
that didn't work either.

Help!!
 
A

Allen Browne

Four issues:

1. When you are running this code;

2. Whether the subform actually has the record (or if you need to find the
appropriate record in the main form first).

3. Whether you are actually finding the desired record, and

4. Whether the subform has focus. (Attempting to SelectRecord won't work if
it doesn't).

Assuming you have the first 3 correct, and that the code is running from the
main form:

With Me.[NameOfYourSubformControlHere]
.SetFocus
.Form![NameOfSomeControlOnTheSubformHere].SetFocus
RunCommand acCmdSelectRecord
End With
 

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