How to set the current record of another form

  • Thread starter Thread starter paul.schrum
  • Start date Start date
P

paul.schrum

Access 2002.

Hi. I am an experienced programmer in C, but rather new to Access
programming. I suppose the question I am about to ask has been asked
and answered before, but I have not been able to find it just by
searching. But if anyone knows of a thread I should read, please point
me to it. I don't want to ask people to answer the same question over
and over.

Okay, now for the question.

I want to be able to move the current record of frm_manageKeys based on
a selection made by the user interacting with
frm_manageKeys_findByName. Can anyone help me with how to do this?

I have been looking over my books, but if the answer is in one of them,
it will take some more gleaning.

Here is a little more information. frm_manageKeys_findByName contains
a list box of names, an OK button and a Cancel button. It is bound to
the same query as frm_manageKeys is, so once I find out which Name is
selected on _findByName I should have what I need (primary key value?
bookmark value?) to make it work.

Finally, for clarification, the database is about door keys


- Paul Schrum
 
I would create a public sub on the form with the records.

Public Sub FindKey(Key as Integer)


'TODO Record stuff here



End Sub

Obviously The Integer type argument I use would be changed to taste.

Essentially you could then reset the forms recordsource to some new SQL you
string together with your key.
or
You could use the FindFirst on the forms recordset property (it's a dao
recordset supporting nearly all the std functionality)

or

you could use the bookmark/recordset clone method used by the combo wizard.

or you could expose an event of the search form and early bind to the search
form in the main during form load or some other trigger(in case it's not
loaded) then there is no need of the public procedure and you can use the
search form with _any_ other form. (the sql stuff still applies)

peter walker
 
Back
Top