Why are you using a sub form. Why not just have your form with a combo box in the forms header. Use the combo box After Update event to apply a filter to the form.
Why are you using a sub form. Why not just have your form with a combo box in the forms header. Use the combo box After Update event to apply a filter to the form.
#
Private Sub Registration_AfterUpdate()
If IsNull(SN) Then SparesDueSAP.Form.Filter = "" Else SparesDueSAP.Form.Filter = "SN=" & SN
SparesDueSAP.Form.FilterOn = True
End Sub#
presume you mean you don't get an error and SN is numeric and is the name of your combo and your field? And the combo is not bound. What is the value of SN?
The combo box runs according to the value in the first column of the query found in the row source of the combo box. Whatever you used in the first column, you should show it as a criterion. Of course there are some exceptions. What are these exceptions? Let's say that the box that you open will filter according to the value in the 3rd column. In this case;
Name = cmbSampleBox.Column (2)
You can write.
presume you mean you don't get an error and SN is numeric and is the name of your combo and your field? And the combo is not bound. What is the value of SN?
Private Sub Registration_AfterUpdate()
If IsNull(SN) Then SparesDueSAP.Form.Filter = ""
SparesDueSAP.Form.FilterOn = False
Else
SparesDueSAP.Form.Filter = "SN=" & SN
SparesDueSAP.Form.FilterOn = True
End If
End Sub
Or:
Code:
Private Sub Registration_AfterUpdate()
If IsNull(SN) Then SparesDueSAP.Form.Filter = ""
SparesDueSAP.Form.FilterOn = False
Else
SparesDueSAP.Form.Filter = "SN='" & SN & "'"
SparesDueSAP.Form.FilterOn = True
End If
End Sub