Filter on form load (1 Viewer)

DavidCon

Registered User.
Local time
Today, 06:48
Joined
Apr 14, 2011
Messages
23
Hi All,

I imagine this is a relatively simple question but I have been stuck on this problem for a couple of hours now and seem to be going round in circles.

I have a table with a [Follow up] date and a form which references this.

What I’m trying to achieve is on the form load, filter out anything future dates.

This is what I’ve tried so far but had no luck

Private Sub Form_Load()
Me.Filter = [Follow up] <= Date
Me.FilterOn = True
End Sub

Any help on this is appreciated.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:48
Joined
May 7, 2009
Messages
19,246
Me.Filter = "[Follow up] <= Date"
 

DavidCon

Registered User.
Local time
Today, 06:48
Joined
Apr 14, 2011
Messages
23
Thanks for the quick response. I've just tried this and it is not applying the filter.

Is the [Follow up] referencing the actual table or the form? Do I need to add something like

Me.Filter = "forms[FrmName]![Follow up] <= Date"
 

DavidCon

Registered User.
Local time
Today, 06:48
Joined
Apr 14, 2011
Messages
23
hmm, I've just created a new database to test this out on and it works fine. No idea why the filter is not being applied on the form load in my original database
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:48
Joined
May 7, 2009
Messages
19,246
check the field name of your table, are the spaces correct. better edit your table then copy and paste the field name to the code. you do not need to add forms!. check the recordsource of your form, is [Follow up] field being renamed in the query?
 

Users who are viewing this thread

Top Bottom