 | 
04-Nov-2005, 15:20 PM
|  | Guest | | | | | | | | | | Linking two Forms I have a form where users will do all their data entry. I have another form
where they can add additional information for that particular record. The can Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/6661-linking-two-forms.html
click on a command button to access this other form. But when they click on
this button I want to be able to carry over the Primary key field (the
autonumberID) and have it populate a field on this other form. This way I can
tie the two tables together. But here's the catch, I want people to also
access this other form via the switchboard as well without carrying over the
Primary Key from that main form. There are two way to create a record on this Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
form. One is directly and the other is through the main data entry form.
There are two ways a record can be generated. Am I making sense here? Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh! | 
04-Nov-2005, 15:20 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms From form one...
DoCmd.OpenForm "SecondForm", , , "[SomeID] = Forms![FormOne]![SomeID]"
--
Joan Wild
Microsoft Access MVP
Secret Squirrel wrote:
> I have a form where users will do all their data entry. I have
> another form where they can add additional information for that Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> particular record. The can click on a command button to access this Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> other form. But when they click on this button I want to be able to
> carry over the Primary key field (the autonumberID) and have it
> populate a field on this other form. This way I can tie the two
> tables together. But here's the catch, I want people to also access
> this other form via the switchboard as well without carrying over the
> Primary Key from that main form. There are two way to create a record
> on this form. One is directly and the other is through the main data
> entry form. There are two ways a record can be generated. Am I making
> sense here? | 
04-Nov-2005, 15:20 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms But will that second form always open to that specific record if it's tied
into the first record?
"Joan Wild" wrote:
> From form one...
> DoCmd.OpenForm "SecondForm", , , "[SomeID] = Forms![FormOne]![SomeID]" Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
>
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > I have a form where users will do all their data entry. I have
> > another form where they can add additional information for that
> > particular record. The can click on a command button to access this
> > other form. But when they click on this button I want to be able to
> > carry over the Primary key field (the autonumberID) and have it
> > populate a field on this other form. This way I can tie the two
> > tables together. But here's the catch, I want people to also access Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> > this other form via the switchboard as well without carrying over the
> > Primary Key from that main form. There are two way to create a record
> > on this form. One is directly and the other is through the main data
> > entry form. There are two ways a record can be generated. Am I making
> > sense here?
>
>
> | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms Yes
--
Joan Wild
Microsoft Access MVP
Secret Squirrel wrote:
> But will that second form always open to that specific record if it's
> tied into the first record?
>
> "Joan Wild" wrote:
>
>> From form one...
>> DoCmd.OpenForm "SecondForm", , , "[SomeID] = Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661 Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
>> Forms![FormOne]![SomeID]"
>>
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Secret Squirrel wrote:
>>> I have a form where users will do all their data entry. I have
>>> another form where they can add additional information for that
>>> particular record. The can click on a command button to access this
>>> other form. But when they click on this button I want to be able to
>>> carry over the Primary key field (the autonumberID) and have it
>>> populate a field on this other form. This way I can tie the two
>>> tables together. But here's the catch, I want people to also access
>>> this other form via the switchboard as well without carrying over
>>> the Primary Key from that main form. There are two way to create a
>>> record on this form. One is directly and the other is through the
>>> main data entry form. There are two ways a record can be generated.
>>> Am I making sense here? | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms Sorry I was confused with another thread. You are putting that code in the
first form's module. So it will only apply when you open the second form Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
from the first.
It's not 'tied' to the first record. If you open your first form and go to
the 6th record (ID=559 for eg.), and you hit the button to open the second
form; the second form will open to show you related information for ID=559.
Perhaps I misunderstand your question.
--
Joan Wild
Microsoft Access MVP
Secret Squirrel wrote:
> But will that second form always open to that specific record if it's
> tied into the first record?
>
> "Joan Wild" wrote:
>
>> From form one...
>> DoCmd.OpenForm "SecondForm", , , "[SomeID] =
>> Forms![FormOne]![SomeID]"
>>
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Secret Squirrel wrote:
>>> I have a form where users will do all their data entry. I have
>>> another form where they can add additional information for that
>>> particular record. The can click on a command button to access this
>>> other form. But when they click on this button I want to be able to
>>> carry over the Primary key field (the autonumberID) and have it
>>> populate a field on this other form. This way I can tie the two
>>> tables together. But here's the catch, I want people to also access
>>> this other form via the switchboard as well without carrying over
>>> the Primary Key from that main form. There are two way to create a
>>> record on this form. One is directly and the other is through the
>>> main data entry form. There are two ways a record can be generated.
>>> Am I making sense here? | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms Ok now I'm confused. ;-) I am putting this code in the first forms module?
Where exactly is that? The way you explained it below is exactly what I am
looking for.
"Joan Wild" wrote:
> Sorry I was confused with another thread. You are putting that code in the
> first form's module. So it will only apply when you open the second form
> from the first.
>
> It's not 'tied' to the first record. If you open your first form and go to
> the 6th record (ID=559 for eg.), and you hit the button to open the second Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> form; the second form will open to show you related information for ID=559.
>
> Perhaps I misunderstand your question.
>
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > But will that second form always open to that specific record if it's
> > tied into the first record?
> >
> > "Joan Wild" wrote:
> >
> >> From form one...
> >> DoCmd.OpenForm "SecondForm", , , "[SomeID] =
> >> Forms![FormOne]![SomeID]"
> >>
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >> Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> >> Secret Squirrel wrote:
> >>> I have a form where users will do all their data entry. I have
> >>> another form where they can add additional information for that
> >>> particular record. The can click on a command button to access this
> >>> other form. But when they click on this button I want to be able to
> >>> carry over the Primary key field (the autonumberID) and have it
> >>> populate a field on this other form. This way I can tie the two
> >>> tables together. But here's the catch, I want people to also access
> >>> this other form via the switchboard as well without carrying over
> >>> the Primary Key from that main form. There are two way to create a
> >>> record on this form. One is directly and the other is through the
> >>> main data entry form. There are two ways a record can be generated.
> >>> Am I making sense here?
>
>
> | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms OK, let's start from square one.
You wrote
"I have a form where users will do all their data entry. I have
another form where they can add additional information for that
particular record. The can click on a command button to access
this other form."
I'm referring to the code you have in the click event for this command
button. It should be something like
DoCmd.OpenForm "SecondForm", , , "[SomeID] = Forms![FormOne]![SomeID]"
You would substitute the name of your second form for SecondForm; the name
of the primary key field for SomeID.
How about you post what is currently in the click event for your command
button, and also the name of the primary key field in the one form and the
name of the foreign key in the second form.
--
Joan Wild
Microsoft Access MVP
Secret Squirrel wrote:
> Ok now I'm confused. ;-) I am putting this code in the first forms
> module? Where exactly is that? The way you explained it below is
> exactly what I am looking for.
>
> "Joan Wild" wrote:
>
>> Sorry I was confused with another thread. You are putting that code
>> in the first form's module. So it will only apply when you open the
>> second form from the first.
>>
>> It's not 'tied' to the first record. If you open your first form
>> and go to the 6th record (ID=559 for eg.), and you hit the button to
>> open the second form; the second form will open to show you related
>> information for ID=559.
>>
>> Perhaps I misunderstand your question. Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
>>
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Secret Squirrel wrote:
>>> But will that second form always open to that specific record if
>>> it's tied into the first record?
>>>
>>> "Joan Wild" wrote:
>>>
>>>> From form one...
>>>> DoCmd.OpenForm "SecondForm", , , "[SomeID] =
>>>> Forms![FormOne]![SomeID]"
>>>>
>>>>
>>>> --
>>>> Joan Wild
>>>> Microsoft Access MVP
>>>>
>>>> Secret Squirrel wrote:
>>>>> I have a form where users will do all their data entry. I have
>>>>> another form where they can add additional information for that
>>>>> particular record. The can click on a command button to access
>>>>> this other form. But when they click on this button I want to be Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
>>>>> able to carry over the Primary key field (the autonumberID) and
>>>>> have it populate a field on this other form. This way I can tie
>>>>> the two tables together. But here's the catch, I want people to
>>>>> also access this other form via the switchboard as well without
>>>>> carrying over the Primary Key from that main form. There are two
>>>>> way to create a record on this form. One is directly and the
>>>>> other is through the main data entry form. There are two ways a
>>>>> record can be generated. Am I making sense here? | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms Ok here is the code from my command button. It is what you said it should be
but when I key information on the second page and then exit out and go back
into it the data is blank. Almost like it's starting a new record.
Private Sub Command209_Click()
On Error GoTo Err_Command209_Click
DoCmd.OpenForm "frmCorrectiveActionRMA", , , "[RMA#] = Forms![2005
Form]![RMA#]"
Exit_Command209_Click:
Exit Sub
Err_Command209_Click:
MsgBox Err.Description
Resume Exit_Command209_Click
End Sub
My primary key on my first form is RMA#. The foreign key on the second form
is also RMA#. I have the foreign key linked to the first form's RMA#. Is that
correct also?
"Joan Wild" wrote:
> OK, let's start from square one.
>
> You wrote
>
> "I have a form where users will do all their data entry. I have
> another form where they can add additional information for that
> particular record. The can click on a command button to access
> this other form."
>
> I'm referring to the code you have in the click event for this command
> button. It should be something like
> DoCmd.OpenForm "SecondForm", , , "[SomeID] = Forms![FormOne]![SomeID]"
>
> You would substitute the name of your second form for SecondForm; the name
> of the primary key field for SomeID.
>
> How about you post what is currently in the click event for your command
> button, and also the name of the primary key field in the one form and the
> name of the foreign key in the second form.
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Secret Squirrel wrote:
> > Ok now I'm confused. ;-) I am putting this code in the first forms
> > module? Where exactly is that? The way you explained it below is
> > exactly what I am looking for.
> >
> > "Joan Wild" wrote:
> >
> >> Sorry I was confused with another thread. You are putting that code
> >> in the first form's module. So it will only apply when you open the
> >> second form from the first.
> >>
> >> It's not 'tied' to the first record. If you open your first form
> >> and go to the 6th record (ID=559 for eg.), and you hit the button to
> >> open the second form; the second form will open to show you related
> >> information for ID=559.
> >>
> >> Perhaps I misunderstand your question.
> >>
> >>
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >>
> >> Secret Squirrel wrote:
> >>> But will that second form always open to that specific record if
> >>> it's tied into the first record?
> >>>
> >>> "Joan Wild" wrote:
> >>>
> >>>> From form one...
> >>>> DoCmd.OpenForm "SecondForm", , , "[SomeID] =
> >>>> Forms![FormOne]![SomeID]"
> >>>>
> >>>>
> >>>> --
> >>>> Joan Wild Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> >>>> Microsoft Access MVP
> >>>>
> >>>> Secret Squirrel wrote:
> >>>>> I have a form where users will do all their data entry. I have
> >>>>> another form where they can add additional information for that
> >>>>> particular record. The can click on a command button to access
> >>>>> this other form. But when they click on this button I want to be Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> >>>>> able to carry over the Primary key field (the autonumberID) and
> >>>>> have it populate a field on this other form. This way I can tie
> >>>>> the two tables together. But here's the catch, I want people to
> >>>>> also access this other form via the switchboard as well without
> >>>>> carrying over the Primary Key from that main form. There are two
> >>>>> way to create a record on this form. One is directly and the
> >>>>> other is through the main data entry form. There are two ways a
> >>>>> record can be generated. Am I making sense here?
>
>
> | 
05-Nov-2005, 12:48 PM
|  | Guest | | | | | | | | | | Re: Linking two Forms
Secret Squirrel wrote:
> Ok here is the code from my command button. It is what you said it
> should be but when I key information on the second page and then exit Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
> out and go back into it the data is blank. Almost like it's starting
> a new record.
Check the properties for the second form. Perhaps you have it set to 'Data Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6661
Entry' - yes. That will always open the form to a new record, and show no
existing records.
--
Joan Wild
Microsoft Access MVP | 
Support Us! Become a Promoter! | | Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh! | (View-All)
Members who have read this thread : 0
| | There are no names to display. | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Tools | Search | | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is On | | | | » Active Discussions | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | » Books You Should Read... | | | |