Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box in a Split Form

Status
Not open for further replies.

JOEYB99

Technical User
Jul 9, 2008
121
CA
I am using Access 2007 and have created a split form.

Using the wizard I then added a combo box for the user to select records based on a field called Formatted Cost Code. The wizard left a macro in the After Update property of the control for the combo box. I converted this to VBA using the Access 'conversion wizard', resulting in the following code,


Private Sub cmbBxFormattedCostCode_AfterUpdate()
On Error GoTo Combo39_AfterUpdate_Err

DoCmd.SearchForRecord , "", acFirst, "[RecordID] = " & Str(Nz(Screen.ActiveControl, 0))

Combo39_AfterUpdate_Exit:
Exit Sub

Combo39_AfterUpdate_Err:
MsgBox Error$
Resume Combo39_AfterUpdate_Exit

End Sub


But I want the user to be able to filter out all records that don't match the "cost code" selection. So I searched 'Net and found a posting called "Filtering split form records from combo box", and found a response by Bob Larson on 10/02/2009. He suggested the following code be inserted into the After Update property of the control for the combo box,



Me.Filter = "[Formatted Cost Code]='" & [cmbBxFormattedCostCode] & "'"

Me.FilterOn = True



I have inserted this code but I am not getting the desired effect. When I make a selection using the combo box I see the records I want in the datasheet view but I also see all other records.

What am I doing wrong?


 
Anyway what is the real name of the combo: Combo39 or cmbBxFormattedCostCode ???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top