By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Linked Forms?

P: n/a
Hi all.

I'm fairly new to access (97) programming so please forgive me if this
has been asked a thousand times.

I have a two forms: Form A open forms B by a button/control (form B
enters additional information as required by the user). I need both
forms to share the same (open) record. Form B is not a subform because
both forms were designed independantly. Basically, the two forms cover
all the fields of the record bewteen them and the only reason that two
forms are being used is because of screen real estate.

How do I pass data between the two forms and the same record without
using Global variables or a subform?

Thanks,
Clive

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Put the following code in the click event of Form A:

DoCmd.RunCommand acSaveRecord
DoCmd.OpenForm "[Form B]",,,'[NameOfPKField] = " & Me!NameOfPKField
Me.Visible = False

Put this code in Form B's AfterUpdate event:

Forms![Form A].Requery

Put this code in Form B's OnClose event:

Forms![Form A].Visible = True

When you click the button on Form A, the current record on Form A will be saved.
This is so if you just entered data in Form A but had not yet saved the record,
the data gets saved and shows up on Form B when it opens if any of the fields on
Form A are also on Form B. After saving the record, the openform method opens
Form B to the same record as Form A. Form A then becomes not visible.

The code in Form B updates Form A everytime a record is saved including when
Form B is closed so when Form A becomes visible it shows the data that was
entered on Form B if Form A contains any fields that are on Form B.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Clive@The Coin-Op Cauldron" <Cl**********@netscape.net> wrote in message
news:40**************@netscape.net...
Hi all.

I'm fairly new to access (97) programming so please forgive me if this
has been asked a thousand times.

I have a two forms: Form A open forms B by a button/control (form B
enters additional information as required by the user). I need both
forms to share the same (open) record. Form B is not a subform because
both forms were designed independantly. Basically, the two forms cover
all the fields of the record bewteen them and the only reason that two
forms are being used is because of screen real estate.

How do I pass data between the two forms and the same record without
using Global variables or a subform?

Thanks,
Clive

Nov 12 '05 #2

P: n/a
DMH
On Tue, 18 May 2004 19:02:19 -0400, "Clive@The Coin-Op Cauldron"
<Cl**********@netscape.net> wrote:
How do I pass data between the two forms and the same record without
using Global variables or a subform?


Alternatively, you can use a tab control and get almost unlimited real
estate, and just drop fields on the pages as if it were a single form.
The tabs all use the same recordset, so no linking or code is
necessary.
Nov 12 '05 #3

P: n/a
PC Datasheet wrote:
Put the following code in the click event of Form A:

DoCmd.RunCommand acSaveRecord
DoCmd.OpenForm "[Form B]",,,'[NameOfPKField] = " & Me!NameOfPKField
Me.Visible = False

Put this code in Form B's AfterUpdate event:

Forms![Form A].Requery

Put this code in Form B's OnClose event:

Forms![Form A].Visible = True

When you click the button on Form A, the current record on Form A will be saved.
This is so if you just entered data in Form A but had not yet saved the record,
the data gets saved and shows up on Form B when it opens if any of the fields on
Form A are also on Form B. After saving the record, the openform method opens
Form B to the same record as Form A. Form A then becomes not visible.

The code in Form B updates Form A everytime a record is saved including when
Form B is closed so when Form A becomes visible it shows the data that was
entered on Form B if Form A contains any fields that are on Form B.

Ah, requerying, I like that idea. Thanks, I'll give it a try!

Clive
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Clive@The Coin-Op Cauldron" <Cl**********@netscape.net> wrote in message
news:40**************@netscape.net...
Hi all.

I'm fairly new to access (97) programming so please forgive me if this
has been asked a thousand times.

I have a two forms: Form A open forms B by a button/control (form B
enters additional information as required by the user). I need both
forms to share the same (open) record. Form B is not a subform because
both forms were designed independantly. Basically, the two forms cover
all the fields of the record bewteen them and the only reason that two
forms are being used is because of screen real estate.

How do I pass data between the two forms and the same record without
using Global variables or a subform?

Thanks,
Clive


Nov 12 '05 #4

P: n/a
>How do I pass data between the two forms and the same record without
using Global variables or a subform?


Look into using OpenArgs. When form A opens form B, you can use open
args to effectively pass a parameter. When form B opens, it can read
the contents of OpenArgs.

Chuck
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.