Passing Autonumber to Linked Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function
 
Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

Cindy said:
Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

Klatuu said:
Forms!resumes!SomeControl = Me.SomeControl
 
Where do I put that code?

Klatuu said:
Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

Cindy said:
Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

Klatuu said:
Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
When do you want it to happen?


Cindy said:
Where do I put that code?

Klatuu said:
Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

Cindy said:
Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
When I open the "resume" form from the "candidates" form

Klatuu said:
When do you want it to happen?


Cindy said:
Where do I put that code?

Klatuu said:
Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

:

Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
I think you might want to do it here.

Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Forms![Resume]!CandidateID = Me.CandidateID
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub


Cindy said:
When I open the "resume" form from the "candidates" form

Klatuu said:
When do you want it to happen?


Cindy said:
Where do I put that code?

:

Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

:

Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
Thank you, I'll try that.

Klatuu said:
I think you might want to do it here.

Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Forms![Resume]!CandidateID = Me.CandidateID
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub


Cindy said:
When I open the "resume" form from the "candidates" form

Klatuu said:
When do you want it to happen?


:

Where do I put that code?

:

Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

:

Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
It still isn't working ... any other suggestions?

Cindy said:
Thank you, I'll try that.

Klatuu said:
I think you might want to do it here.

Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Forms![Resume]!CandidateID = Me.CandidateID
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub


Cindy said:
When I open the "resume" form from the "candidates" form

:

When do you want it to happen?


:

Where do I put that code?

:

Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

:

Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
Disregard. I got it working. Thanks for your help.

Cindy said:
It still isn't working ... any other suggestions?

Cindy said:
Thank you, I'll try that.

Klatuu said:
I think you might want to do it here.

Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Forms![Resume]!CandidateID = Me.CandidateID
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub


:

When I open the "resume" form from the "candidates" form

:

When do you want it to happen?


:

Where do I put that code?

:

Your code appears to be be correct.
You original question had nothing to do with what you have here. You asked
now to get the value of a control on one form into another.

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?

The code I posted will do that.

:

Sorry, I'm not as savvy as you. This is the code that links the form ... can
you tell me where it change it?

Option Compare Database

Sub Form_Current()
On Error GoTo Form_Current_Err

If ChildFormIsOpen() Then FilterChildForm

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Error$
Resume Form_Current_Exit

End Sub
Sub ToggleLink_Click()
On Error GoTo ToggleLink_Click_Err

If ChildFormIsOpen() Then
CloseChildForm
Else
OpenChildForm
FilterChildForm
End If

ToggleLink_Click_Exit:
Exit Sub

ToggleLink_Click_Err:
MsgBox Error$
Resume ToggleLink_Click_Exit

End Sub
Private Sub FilterChildForm()

If Me.NewRecord Then
Forms![Resume].DataEntry = True
Else
Forms![Resume].Filter = "[Candidate ID] = " & Me.[Candidate ID]
Forms![Resume].FilterOn = True
End If

End Sub
Private Sub OpenChildForm()

DoCmd.OpenForm "Resume"
If Not Me.[ToggleLink] Then Me![ToggleLink] = True

End Sub
Private Sub CloseChildForm()

DoCmd.Close acForm, "Resume"
If Me![ToggleLink] Then Me![ToggleLink] = False

End Sub
Private Function ChildFormIsOpen()

ChildFormIsOpen = (SysCmd(acSysCmdGetObjectState, acForm, "Resume") And
acObjStateOpen) <> False

End Function

:

Forms!resumes!SomeControl = Me.SomeControl

:

I apologize to those who tried to help me when I was calling it a "subform"
instead of a "linked form".

I have a form (candidates) and a linked form (resumes). I am trying to pass
the autonumber primary key (Candidate ID) on the first form to the same field
on the Resume form. How can this be done?
 
Back
Top