Changing form goes back to 1st record

hinckleyj

J Hinckley
Local time
Today, 20:40
Joined
Dec 30, 2007
Messages
6
Hi All,
I have designed an Access 2002 database which allows entries into a table. There are 3 forms, each allowing entry into the table and I have used buttons to open a macro to move between the 3 views.

The problem I have is that when you change to another view (form), the first record is displayed rather than the one I am working on. How do you change forms and retain the same record between them?

Thanks in advance to anyone who knows this

Regards

John
 
Not sure about how you would go about it using macros (gave them away years ago)
But code....

To open the second form with only that record:

Docmd.OpenForm "YourFormName",,,"IDField = " & Me.IDField

To open the second form and goto the record


Dim rs as Object

Docmd.OpenForm "YourFormName"
Set rs = Forms!YourFormName.Recordset.Clone
rs.FindFirst "IDField = " & me.IDField
Forms!YourFormName.Bookmark = rs.bookmark

This is based on the ID field being an AutoNumber and the Primary Key
just change the names to suit.

Dave
 
Did I read your post correctly? You have 3 forms to enter data into a single table? If that's correct, in using 3 forms for data entry, you're going thru extra trouble (as evidenced by this very thread) for nothing! Use one form, with tabbed pages to hold your various controls. All of the controls are referenced in the same way as they would be if they appeared on a single screen, and they are, of course, automatically "synched" as it were.

Linq
 
Many thanks

Thanks guys for your help.

I like the idea of the tabbed pages. Are you able to explain how to do this (unless its too complicated to detail here), or at least point me in the right direction.

Many thanks again

John
 
Sure! I have this very short primer I keep for doing just that!

Using Tabbed Pages

First thing to remember is that the Tabbed Pages are all part of a single form; think of it as a really long form turned on its side. Because it is all one form, all referencing to any control on it is done in the same manner as if they were all on one single screen. Create a form in Design View. Goto the toolbox and click on the Tabbed Control icon; it actually looks like several manila file folders. Place it on your form and adjust the size to your liking. If you need more than the two tabbed pages it initially gives you, click on the Tab Control to select it, then goto Insert and click on Tab Control Page and another tabbed page will be added. Do this as many times as necessary.

This is the really important part! when you go to add a control such as a textbox to a tabbed page, you must first click to select one of the pages, then add the control. Otherwise, the control will be added to the form itself, and will show thru on all tabbed pages! Of course, there may be times when you want a control to show on all tabbed pages! On a customer form, for example, you might want the customer's name to show up on every page. In that case, you'd place the textbox on the Tab Control without selecting a page first.

Once you have the form's Control Source (your table or a query) set up, you simple add controls as you normally would, heeding the above paragraph.

Post back if you have any problems.

Good Luck and have a Happy New Year!

Linq
 
Thanks a million

Hi Linq,

That's fantastic! Many thanks. I'm trying that now.

Happy New Year to you

John
 

Users who are viewing this thread

Back
Top Bottom