G
Guest
I have an odd occurrence of this error ("You can't reference a property or
method for a control unless the control has the focus").
I have a continuous form that has text boxes in the header. These are used
as filters for the form. One is for the client and two are for a date range.
I apply the filter by a reference to the control in the Where clause in the
form's record source and simply do a Me.Requery after the update of any of
the filtering controls.
WHERE ((([Forms]![TimeLog]![FilterClientID]) Is Null)) OR
((([Forms]![TimeLog]![FilterClientID]) Is Not Null) AND
((TimeLog.ClientID)=[Forms]![TimeLog]![FilterClientID]));
This simply stipulates that if the ClientID filter is null, show records for
all clients; otherwise show the records pertaining to the selected ClientID.
The date filter Where clauses are like this (one for <=DateFrom, the other
for >+DateTo):
WHERE ((([Forms]![TimeLog]![FilterDateFrom]) Is Null)) OR
((([Forms]![TimeLog]![FilterDateFrom]) Is Not Null) AND
((TimeLog.DateFrom)>=[Forms]![TimeLog]![FilterDateFrom]));
This simply specifies that if the date filter is null, show all dates from
the beginning of time; otherwise show dates from the filter date forward.
Here is the problem: when (and only when) the client filter is populated and
I click on either of the two date filter fields, I get the 2185 error. Here
is the Click event code (it just selects the entire field so I can easily
edit after clicking):
Private Sub FilterDateFrom_Click()
With Me.FilterDateFrom
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
The error does not occur when FilterClientID is null or when I remove the
ClientID filter from the Where clause.
Ideas?
method for a control unless the control has the focus").
I have a continuous form that has text boxes in the header. These are used
as filters for the form. One is for the client and two are for a date range.
I apply the filter by a reference to the control in the Where clause in the
form's record source and simply do a Me.Requery after the update of any of
the filtering controls.
WHERE ((([Forms]![TimeLog]![FilterClientID]) Is Null)) OR
((([Forms]![TimeLog]![FilterClientID]) Is Not Null) AND
((TimeLog.ClientID)=[Forms]![TimeLog]![FilterClientID]));
This simply stipulates that if the ClientID filter is null, show records for
all clients; otherwise show the records pertaining to the selected ClientID.
The date filter Where clauses are like this (one for <=DateFrom, the other
for >+DateTo):
WHERE ((([Forms]![TimeLog]![FilterDateFrom]) Is Null)) OR
((([Forms]![TimeLog]![FilterDateFrom]) Is Not Null) AND
((TimeLog.DateFrom)>=[Forms]![TimeLog]![FilterDateFrom]));
This simply specifies that if the date filter is null, show all dates from
the beginning of time; otherwise show dates from the filter date forward.
Here is the problem: when (and only when) the client filter is populated and
I click on either of the two date filter fields, I get the 2185 error. Here
is the Click event code (it just selects the entire field so I can easily
edit after clicking):
Private Sub FilterDateFrom_Click()
With Me.FilterDateFrom
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub
The error does not occur when FilterClientID is null or when I remove the
ClientID filter from the Where clause.
Ideas?