Counting records in filtered form from junction table

  • Thread starter Thread starter Leonard
  • Start date Start date
L

Leonard

Hi

I have a form based on a junction table.

I filter this form for an activity

DoCmd.applyFilter, "ActivityName = " & cmbactivity


All works well. Except, when there is no activity, the form still displays
the first record in the table and displays a 1 record count in the status
bar.

One possible solution I thought was to count the filtered records and if =1
then null all other controls.

So, how could I count the filtered records or is there something I'm really
missing here?

Thanks

Leonard
 
Hi,



cmbActivity cannot return Null, an error would have occurred. There is
probably a not null value returned by cmbActivity that makes the criteria
satisfied for one record, the one you see displayed.


You can try:

If 0=len(Me.cmbActivity & vbNullString) then
DoCmd.ApplyFilter, False
Else
DoCmd.applyFilter, "ActivityName = FORMS!FormNameHere!cmbActivity"
End If



Hoping it may help,
Vanderghast, Access MVP
 
Thanks for that Michael, great idea that works!

I have another follow-on question but I'll post it as a new post.

Much appreciated

Leonard
 
Back
Top