Refreshing filter on Subform in Access 2010

Joined
Sep 18, 2015
Messages
1
Reaction score
0
Hi

I'm new to this so hope I'm explaining this right. I'm creating a purchasing database for an engineering department. I've attached an image of my database for clarity.

Basically, I have text boxes in a form (frmReq) for data entry. These would be completed by the engineer when they want to purchase something. Typically multiple things would be purchased at once under one requisition number.

Underneath that, I've put a subform (frmQryRequisitionSub) which is created using the query qryRequisition.

I want the subform to filter using the RecNumber combo box, so that only those items which are currently being added to appear.

This is filtered using:

Code:
Private Sub cboRecNumber_Click()
Dim strWhere As String
With Me.cboRecNumber
If .Text = vbNullString Then
strWhere = "(False)"
Else
strWhere = "[RecNumber] Like """ & .Text & "*"""
End If
End With
With Me.[frmQryRequisitionSub].Form
.Filter = strWhere
.FilterOn = True
End With

When data is entered into the text boxes, there is an "add" button with the code:

Code:
Private Sub cmdAdd_AfterUpdate()
'add data to table
CurrentDb.Execute "INSERT INTO Requisition (RecNumber, Originator, RecDate)" & _
"VALUES(' " & Me.cboRecNumber & "',' " & Me.txtOriginator & " ',' " & Me.txtRecDate & "')"

'refresh data list on form
Me.frmQryRequisitionSub.Requery

Both the filter and the add button currently work. However, nothing I add after the filter has been added will appear.

I would really appreciate if anyone can help me with this
 

Attachments

  • Req database screenshot.webp
    Req database screenshot.webp
    25 KB · Views: 211
Last edited:
Back
Top