ServerFilterByForm and On Current Event problems

E

Ed Swartz

I have form with an On Current event with the following code:

Private Sub Form_Current

DateVal = "" & Me!LotterySubmissionDate

If DateVal = "01-Jan-1900" Then
DateVal = "In Queue"
End If

Me!LotterySubmissionDate2 = DateVal
End Sub



This worked fine in the past

Today I enabled the ServerFilterByForm.

Now when I open the form I get Error 2424 "The expression you entered
has a field, control, or property name that Microsoft Access can't
find". The error occurs on the 1st line of code in the Form_Current
routine (DateVal = "" & Me!LotterySubmissionDate)

When selected records are found I need to check the Lottery Submission
Date and if 01-Jan-1900 I need to set it to "In Queue".

Any ideas how to workaround this problem ?

Ed
 
V

Vadim Rapp

ES> Now when I open the form I get Error 2424 "The
ES> expression you entered has a field, control, or
ES> property name that Microsoft Access can't find".
ES> The error occurs on the 1st line of code in the
ES> Form_Current routine (DateVal = "" &
ES> Me!LotterySubmissionDate)

with serverfilterbyform, Access in fact throws another form for you to
specify the criteria, and only when you apply the filter it shows the "main"
form. I think you have to determine what mode are you in, and run the code
only when in the "regular" mode.

Vadim
 
E

Ed Swartz

Vadim,

Thanks for your answer. How do I determine what mode the form is in ?

ServerFilterByForm boolean flag enables or disables the ServerFilter, so
I don't think I can check that property.

Ed
 
V

Vadim Rapp

ES> ServerFilterByForm boolean flag enables or
ES> disables the ServerFilter

Not so. Those are two absolutely different properties, having little in
common but the name similarity. There's property serverfilterbuform, that's
what you want.

Vadim
 
E

Ed Swartz

Vadim,

After some testing I discovered the following:

1) The MS Access help says that one can "determine" whether the
ServerByFilterForm is displayed or not. When I open a form with
ServerFilterByForm set to True this property displays as True when the
filter form is displayed and when the Apply Server Filter is clicked on.
Thus there is no way to determine (using this field) whether Access is
displaying the ServerByFilterForm or not.

2) The filter appears to work only on exact matches. The user can't
enter partial data for filtering (as far as I can tell).

3) If the user enters data that contains a period, like "Ed.Swartz"
Access thinks this is a table reference and an error occurs and Access
doesn't find the requested data.

Given these problems I need another solution.

Ed
 
V

Vadim Rapp

Since you already know the err.number for this particular error, write the
code appropriately:

On error goto NotRealError
DateVal = "" & Me!LotterySubmissionDate
Goto Normal
NotRealError::
if err.number<>2424 then err.raise err.number,err.source,err.description
Normal:


Vadim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top