Synchronising the form to the value in the ComboBox

  • Thread starter benton via AccessMonster.com
  • Start date
B

benton via AccessMonster.com

there's something baffling me here.Why is it that the ApplyFilterAction on
the macro couldn't work.I attached the macro to the After_update event of the
ComboBox.

Here's my macro to find a Record using the ApplyFilter Action:

Action Action Arguments
ApplFilter Where Condition: [Broker Number]=[Forms]![frmBroker]!
[CboFind]

I'm using Access 2003
 
T

tina

well, since nobody has offered a macro-based solution, you might want to try
doing it with VBA. it's not clear if you want to "find" a specific record on
your form (will there be more than one record that meets the WHERE
condition?), or filter the form's recordset to show only the record(s)
meeting the WHERE condtion. to filter records, add the following code to the
combobox's AfterUpdate event, as

If Not IsNull(Me!CboFind) Then
Me.Filter = "[Broker Number] = " & Me!CboFind
Me.FilterOn = True
Else
Me.FilterOn = False
End If

the above code assumes that the [Broker Number] field is a Number data type,
rather than Text data type.
to simply find a record, without filtering the form's recordset, add the
following code instead to the combobox's AfterUpdate event, as

If Not IsNull(Me!CboFind) Then
Me.Recordset.FindFirst "[Broker Number] = " _
& Me!CboFind
If Me.Recordset.NoMatch Then
MsgBox "No record found."
End If
End If

again, the above code assumes that the [Broker Number] field is a Number
data type, rather than Text data type.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top