Reputation: 13
I have a form contains two subforms (BuyList_Q subform) and (ProductStore_Q subform) I use a button to transfer data from ProductStore to BuyList
Private Sub Command69_Click()
On Error GoTo Err_AddtoOrder_Click
Me.BuyList_Q_subform.Form.BL_PCode.Value = Me.ProductStore_Q_subform.Form.BuyCode.Value
Me.BuyList_Q_subform.Form.BL_PName.Value = Me.ProductStore_Q_subform.Form.P_Name.Value
Me.BuyList_Q_subform.Form.BL_PPrice.Value = Me.ProductStore_Q_subform.Form.P_Price(S).Value
Me.BuyList_Q_subform.Form.BL_PCount.Value = Me.CountNum_txt.Value
Exit_AddtoOrder_Click:
Exit Sub
Err_AddtoOrder_Click:
MsgBox Err.Description
Resume Exit_AddtoOrder_Click
End Sub
all of this working good but this line
Me.BuyList_Q_subform.Form.BL_PPrice.Value = Me.ProductStore_Q_subform.Form.P_Price(S).Value
get the error in the title !! Could you help me to solve this issue?
Upvotes: 1
Views: 54
Reputation: 21370
Issue is with ( ) characters in object name. Advise not to use space nor punctuation/special characters (underscore is exception) in naming convention. If you do, then must enclose in [ ] characters to define name.
Also, not necessary to use .Value
because this is default property for data input controls.
Me.BuyList_Q_subform.Form.BL_PPrice = Me.ProductStore_Q_subform.Form.[P_Price(S)]
Don't do this naming and preserve your sanity.
Upvotes: 1