Y
Yair Sageev
Hi,
I have a subform of a form which consists of continuous detail sections.
Each detail section has a command button which pops-up a form, linked by a
description ID which is the primary key of the detail section's table, and a
foreign key in the pop-up forms table.
The problem I'm having is that the control in the pop-up form is not being
set to the value in the identical control in the parent form detail section,
even though I specified in the wizard that the form should be opened on this
basis.
I've tried using the OpenForm sub:
Private Sub Form_Load()
Dim cCtrl As Control
Set cCtrl = Forms("Percents").Controls("DescId")
cCtrl.Value = DescriptionId
End Sub
And in the parent form button:
Private Sub OpenPercentsForm2_Click()
On Error GoTo Err_OpenPercentsForm2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Percents"
stLinkCriteria = "[DescriptionId]=" & Me![DescriptionId]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenPercentsForm2_Click:
Exit Sub
Err_OpenPercentsForm2_Click:
MsgBox Err.Description
Resume Exit_OpenPercentsForm2_Click
End Sub
But it seems that the DescriptionID of the parent detail section is not the
id, but rather un-entered value of the the descriptionId in the pop-up form.
I have a subform of a form which consists of continuous detail sections.
Each detail section has a command button which pops-up a form, linked by a
description ID which is the primary key of the detail section's table, and a
foreign key in the pop-up forms table.
The problem I'm having is that the control in the pop-up form is not being
set to the value in the identical control in the parent form detail section,
even though I specified in the wizard that the form should be opened on this
basis.
I've tried using the OpenForm sub:
Private Sub Form_Load()
Dim cCtrl As Control
Set cCtrl = Forms("Percents").Controls("DescId")
cCtrl.Value = DescriptionId
End Sub
And in the parent form button:
Private Sub OpenPercentsForm2_Click()
On Error GoTo Err_OpenPercentsForm2_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Percents"
stLinkCriteria = "[DescriptionId]=" & Me![DescriptionId]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenPercentsForm2_Click:
Exit Sub
Err_OpenPercentsForm2_Click:
MsgBox Err.Description
Resume Exit_OpenPercentsForm2_Click
End Sub
But it seems that the DescriptionID of the parent detail section is not the
id, but rather un-entered value of the the descriptionId in the pop-up form.