Open a form and return to the record I had exited the form from

J

JWCrosby

I know that's an awkward subject line, but the best I could do!

I have a form with an unbound combo box in the header. When it is updated
it puts the appropriate record data in the detail section. Initially, the
combobox is blank.

If I open the form, go to a particular record, close the form to look at
something else, then re-open the form I'm back to a blank detail section
until I start over again and re-pick the appropriate record from the combo
box in the header. I'd like it to re-open to the same record data that was
showing when I closed the form.

Possible? If so, how?

Thanks in advance.

Jerry
 
G

George Nicholson

One approach: Don't close the form, just make it invisible. Change whatever
code currently opens the form to check to see if it is already open. If
already open, simply make it visible, otherwise open it.

Otherwise, there are at least 2 other approaches:
- Create a public variable in a general code module and use it to store
your last-used RecNumber.
- Create a new table "User Settings". Store the last-used RecNumber (and
UserName) there.
The first will only save the RecNumber within a session. The second would
allow you to return a user to the RecNumber last used in either current or
previous sessions.

In both cases, you would store the RecNumber within the Combo's AfterUpdate
event (or maybe OnCurrent would be better). Retrieve it in the FormOpen
event. If zero, you leave the combo blank (as now). If not zero, set the
combo to that value and fire whatever "move-to-record" code you are using.

HTH,
 

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