How do i set open form to current record?

A

acss

I have a command button on the main form and when clicked a secondary form
opens however any data keyed in resets the main form back to record one. How
do i set the second form entries to apply to the current record?
 
A

Arvin Meyer [MVP]

I'm going to guess that you are requerying the mainform, so that it updates
from the data in the second form. Instead of Requery try Refresh when you go
back to the main form.
 
F

ferde

I'm having a similiar problem but I was hoping for help on getting my
mainform to open the second form on the same record number. I can get the
second form to open but it always opens on record number one. Both forms are
derived from the same table with the same "ID". I've been reading about
using a "filter" and have tried it a number of times with no success. Any
help would be appreciated
 
A

Arvin Meyer [MVP]

The code would be something like:

DoCmd.OpenForm "SecondFormName",,,"ID = " & Me.txtID

That assumes that txtID is the name of the textbox holding the ID value.
Remember, when you open another form to the exact same record there will be
a locking conflict if you try to edit them both, so save the first form in
the code immediately preceding the OpenForm code.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
A

acss

Would there be additional code in additon to what you provided in order to
save first form data. In my case, i have the first form yet i need to add
more fields but i do not want the form to be crowded. If i place a field on
the main form it fills the table correctly so could you clarify on the usage
of a second form for this purpose and if save data a needed option?

Thanks
 
F

ferde

Thank you for the help

ferde said:
I'm having a similiar problem but I was hoping for help on getting my
mainform to open the second form on the same record number. I can get the
second form to open but it always opens on record number one. Both forms are
derived from the same table with the same "ID". I've been reading about
using a "filter" and have tried it a number of times with no success. Any
help would be appreciated
 

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