Hi,
I have a Form with a Table/Query record source. And have 5 data fields (AssetID, Category, Model, Brand, Status) to that form bound with it's record source table/query. I have another Unbound text box "txtAssetID" where wnat to insert a value from another subform data by a Insert button (VB code) in that SubForm. The Unbound txt box "txtAssetID" will populate with inserted value and apply a filter and show the related data in 5 bounded filed from the Table/Query.
My Subform can insert the Subform's selected data with a Insert button with the button click event code:
Private Sub btnInsert_Click()
Me.Refresh
If Not IsNull(txtAssetID) Then
Forms![Asset-Form].Form.txtAssetID= Me.AssetID
End If
DoCmd.Close
End Sub
This code insert the value to the Main form [Asset-Form] from the AssetID field of the Subform and . And for filter data, the "txtAssetID" unbound text box has after update event code:
Private Sub txtAssetID_AfterUpdate()
Me.Filter = "AssetID=" & Me.txtAssetID
Me.FilterOn = True
End Sub
My problem is , if I type the AssetID in to unbound txt box "txtAssetID" and press Enter, it filters the record and show the data in all five fields. But If I insert the data in to the "txtAssetID" from the subform, nothing happens. It didn't filter anything.
Appreciate your expert solution to work it out.
Thanks
Regards
Leo