filtering subform

  • Thread starter Thread starter NoodNutt
  • Start date Start date
N

NoodNutt

Hi all

Well I'm feeling a little braindead at present.

Just goes to show, a little time away from access is not always a good
thing.

Now I know I can't link an unbound control, so can anyone outline the steps
for it.

User selects from a cbo and the subforms subset returns all matching values.

I know I'm gonna kick myself when I see your responses...........LOL.

TIA
Mark.
 
Hi Mark,

"Now I know I can't link an unbound control"

what version of Access are you using? Have you tried using the combobox
in LinkMasterFields for the subform control? Give it a whirl ;)

on the AfterUpdate event of the combo:

me.subform_controlname.requery

~~~~~~~~
if it doesn't work, then post back and we will give you another way


Warm Regards,
Crystal

*
(: have an awesome day :)
*
 
G'day Crystal

Thx for replying

I'm using acc2007 and saving in acc2000, but the enduser of this will is
using acc2003.

I'm still feeling my way through 2007 after upgrading from acc97 so I'm
still fuzzy on all the new features, of which I'm certain I can't use
especially if I am down saving.

Regards
Mark.
 
Hi Mark,

this method will work in both versions:

set a filter on the subform. Use this on the AfterUpdate event of the combo

'~~~~~~~~~~~~~~~~
dim strFilter as string

'if nothing is filled out
if isNull(me.combo_controlname) then
'show all records
me.subform_controname.FilterOn = false

else

strFilter = "[Fieldname]=" & me.combo_controlname
me.subform_controname.Filter = strFilter
me.subform_controname.FilterOn = true

end if
'~~~~~~~~~~~~~~~~

if the data is text instead of numeric, you will need to delimit the
value from the control

& me.combo_controlname
-->
& "'" & me.combo_controlname & "'"

WHERE
subform_controname is the Name property of the subform control
combo_controlname is the Name property of the combobox control

Warm Regards,
Crystal

*
(: have an awesome day :)
*
 
Back
Top