Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FilterByForm problem

Status
Not open for further replies.

KeARe

Programmer
Aug 8, 2003
8
0
0
PL
Hello,

I have some problem with ServerFilter by form in Access 2000 ADP project.
When i open form with property ServerFilterByForm set to Yes and try to filter data by date field (for example > '2003-01-01') all is correct.
But when i try do it again (even with the same filter) i receive message that expression has incorect syntax and Access can't build filter.
It works correctly only at first try !!! But i don't know why ! I have to run filter very often during work with form.
I also receive the same message when i open filter form after opening form.
This problem relate only to date fields and operations >, <, >=, <=.

Thanks,
Keare
 
Can you show the all the vba code that sets the filter and uses the filter along with the Event Name the code is in.
 
My form has almost no code. But from the beginning ...

First, what i want to achieve. I try user be able to open server filter in any moment of work with application to restrict number of records obtain from sql server. It's also have to substitute advanced filter present in access mdb file.

BUT

Server filter works only once.
I can't activate working server filter during application work. I can activate but no working.

Describe of problem by example ...

1. Create new adp project
2. Create, by wizard, form based on table with date field
3. Set form property, in design mode, ServerFilterByForm on Yes
4. After you run form you can see server filter form. Enter in date field any date with operator (like > '2003-07-01')
5. Submit filter

And all works correctly.

BUT ...

6. On the same form try apply AGAIN server filter. Click button with server filter or choose from menu Records/Filter/ServerFilter (or something like that) and you see that same form like in 4. Enter the same value.

And when field lost focus you receive errors. Server Filter works only after first open of form and never after.

Next example:

1. Create new adp project
2. Create, by wizard, form based on table with date field
3. Set form property, in design mode, ServerFilterByForm on No
4. Open form. Server filter is off and you can't see it.
5. Add function to form

Private Sub Form_Open(Cancel As Integer)
Me.ServerFilterByForm = True
End Sub

6. Open form and you can see server filter form. Enter in date field any date with operator (like > '2003-07-01').

When field lost focus you see error message.

Errors occurs only in case of date fields.

Keare

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top