D
DawnTreader
Hello All
is there a way to change the linkmasterfields and linkchildfields on the fly
based on the possible values in the subform?
i have a subform that needs to be linked based on either 1 or 2 fields
depending on whether or not the data in the underlying table has a value in a
field.
my current code looks like this:
Private Sub sfrmtblStaticPartPrices_Enter()
Dim subfrmRepisEmpty As Integer
subfrmRepisEmpty = Nz(DLookup("ServiceRepID", "tblStaticValues", "IMWPN
= " & "'" & VisualID & "'"), 0)
MsgBox subfrmRepisEmpty
Select Case subfrmRepisEmpty
Case 0
Me.Parent!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID"
Me.Parent!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN"
Case Else
Me.Parent!sfrmtblStaticPartPrices.LinkMasterFields =
"VisualID;ServiceRepID"
Me.Parent!sfrmtblStaticPartPrices.LinkChildFields =
"IMWPN;ServiceRepID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID;ServiceRepID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN;ServiceRepID"
End Select
Me.Requery
End Sub
as you can see i have tried to use stepping up a form by the "parent"
addressing and by jumping right out of the forms all together using the full
"address" to the form.
i may have the syntax on the paths to the subform wrong, but something tells
me i cant do this.
is there another way of attempting what i am doing?
is there a way to change the linkmasterfields and linkchildfields on the fly
based on the possible values in the subform?
i have a subform that needs to be linked based on either 1 or 2 fields
depending on whether or not the data in the underlying table has a value in a
field.
my current code looks like this:
Private Sub sfrmtblStaticPartPrices_Enter()
Dim subfrmRepisEmpty As Integer
subfrmRepisEmpty = Nz(DLookup("ServiceRepID", "tblStaticValues", "IMWPN
= " & "'" & VisualID & "'"), 0)
MsgBox subfrmRepisEmpty
Select Case subfrmRepisEmpty
Case 0
Me.Parent!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID"
Me.Parent!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN"
Case Else
Me.Parent!sfrmtblStaticPartPrices.LinkMasterFields =
"VisualID;ServiceRepID"
Me.Parent!sfrmtblStaticPartPrices.LinkChildFields =
"IMWPN;ServiceRepID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkMasterFields = "VisualID;ServiceRepID"
'
Forms!frmUserPartListCostingMain.Form!frmUserPartListCosting.Form!sfrmtblStaticPartPrices.LinkChildFields = "IMWPN;ServiceRepID"
End Select
Me.Requery
End Sub
as you can see i have tried to use stepping up a form by the "parent"
addressing and by jumping right out of the forms all together using the full
"address" to the form.
i may have the syntax on the paths to the subform wrong, but something tells
me i cant do this.
is there another way of attempting what i am doing?