Giving focus to a row

  • Thread starter Thread starter ScottStoecker
  • Start date Start date
S

ScottStoecker

I'm new to programming Access, and I'm having a problem with giving
focus to a row. What is happening is that I click an OK button in a
form and this opens a new form, which happens without a problem. Next,
the newly opened form is populated from a query which returns all the
organizations in the database. In the form detail section, it returns
(among other things) the OrganizationID field. I would like to give
focus to the OrgID TextBox control in the new form so that this
particular OrganizationID is highlighted for the user. I am
successfully passing the OrganizationID to the new form - I can tell by
checking the value of the OpenArgs parameter.

The problem is that I don't know how to loop through the fields in
Access. I've tried using the RecordSet property, the RecordsetClone
property, looping through each control on the form and searching for
the value passed via the OpenArgs parameter - I just don't know how
Access does this. Can anyone help guide me in the right direction?

Thank you,
Scott
 
I think there's a function called FindFirst that sets the bookmark on a row
based on the value you pass to it. Maybe this is what you need to use.

To loop through...maybe use a For Each loop:

For Each [variant] in [recordset]
[is this the record I want?]
Next [variant]

That's just my thoughts. Good luck.
 
Back
Top