Sort on ID number from list box in split view (Access 2007)

M

Matt P

Hello,
I am trying to filter my form thats in split view to only show the
contacts that share the same ID number. So I would be linking
[lbxSortAdd] (which is a list box with 4 columns- Address /City/ State
and the ID field is hidden), with [AddressID] - which is on the
datasheet part. I tried with only failed attempts to add a vb macro
to the on click event of [lbxSortAdd].

http://i40.tinypic.com/2bsch4.jpg <---pic of my form

Anyone got any hints?

Thanks,
Matt P
 
M

Matt P

Hello,
I am trying to filter my form thats in split view to only show the
contacts that share the same ID number.  So I would be linking
[lbxSortAdd] (which is a list box with 4 columns- Address /City/ State
and the ID field is hidden), with [AddressID] - which is on the
datasheet part.  I tried with only failed attempts to add a vb macro
to the on click event of [lbxSortAdd].

http://i40.tinypic.com/2bsch4.jpg<---pic of my form

Anyone got any hints?

Thanks,
Matt P

Ok so heres how far I got it:


DoCmd.RunCommand acCmdRemoveFilterSort
MsgBox [Forms]![frmContactsAddSplit]![lbxSortAdd] 'test to see
if its grabbing the right results
DoCmd.ApplyFilter , "[AddressID] = Me.lbxSortAdd"

The problem is that its not recognizing the list box in the filter
syntax... everytime I open the form and click on the list box it pops
up with the message of whats the value of Me.lbxSortAdd

I have searched for the correct syntax but I am not seeing it. Anyone
got any ideas?
 
M

Matt P

Hello,
I am trying to filter my form thats in split view to only show the
contacts that share the same ID number.  So I would be linking
[lbxSortAdd] (which is a list box with 4 columns- Address /City/ State
and the ID field is hidden), with [AddressID] - which is on the
datasheet part.  I tried with only failed attempts to add a vb macro
to the on click event of [lbxSortAdd].
Anyone got any hints?
Thanks,
Matt P

Ok so heres how far I got it:

    DoCmd.RunCommand acCmdRemoveFilterSort
    MsgBox [Forms]![frmContactsAddSplit]![lbxSortAdd]    'test tosee
if its grabbing the right results
    DoCmd.ApplyFilter , "[AddressID] = Me.lbxSortAdd"

The problem is that its not recognizing the list box in the filter
syntax... everytime I open the form and click on the list box it pops
up with the message of whats the value of Me.lbxSortAdd

I have searched for the correct syntax but I am not seeing it. Anyone
got any ideas?

Heh nevermind all I had to was change it to:
DoCmd.ApplyFilter , "[AddressID]=" & Me.[lbxSortAdd]

Thanks!
 

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