Hi all,
I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
**********************************************************
Public Function GetTargetType() As Variant
GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]")
End Function
**********************************************************
Which works fine when I test in the immediate window.
Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
**********************************************************
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!target_group = GetTargetType()
'Forms!frmNmsConsumptionEntry!target_group = GetTargetType()
'[tblNmsConsumption.target_group] = GetTargetType()
End Sub
**********************************************************
Need help with making sure I can insert this value once retrived and suggestions on the best way to solve this are welcome
I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
**********************************************************
Public Function GetTargetType() As Variant
GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]")
End Function
**********************************************************
Which works fine when I test in the immediate window.
Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
**********************************************************
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!target_group = GetTargetType()
'Forms!frmNmsConsumptionEntry!target_group = GetTargetType()
'[tblNmsConsumption.target_group] = GetTargetType()
End Sub
**********************************************************
Need help with making sure I can insert this value once retrived and suggestions on the best way to solve this are welcome