Property not found error

S

swas

Hi,
I have a subform to be viewed in both datasheet and form view.

When the form is viewed in form view, no problems. When viewed in datasheet
view the following code generates a 'Property not found' error. The offending
line of code is 'CheckMDBF = False' in the function (Well at least if the
line of code is removed, the error stops).

The function is used in a couple of BeforeUpdate events, with the same
error, and only in DS view.

I don't understand why. Can anyone help?

Thanks

swas


Private Sub MDBF_BeforeUpdate(Cancel As Integer)

If Not CheckMDBF Then
'Setting to low, warned in CheckMDBF

Cancel = True

MDBF.Undo

End If

End Sub


Private Function CheckMDBF() As Boolean
'Checks MDBF and fill freq settings are ok

CheckMDBF = True

If FillFrequency > 0 Then

If MDBF < (FillFrequency * 7) + 1 Then
'MDBF will kick fill in before preschedule will
MsgBox "For '" & FillFrequency.Column(1) & "' Pre Schedule setting,
Max Days Between Fills must be > " & _
FillFrequency * 7 & " days.", vbOKOnly, "Max Days Between Fills
Low"

CheckMDBF = False '*** This line of code causes error in datasheet
view

End If

End If

End Function
 
S

swas

I'm not sure why also, but even with error trapping in place in the 'property
not found' error still comes up.

I have rebuilt the entire form with no luck.

The only other unusual thing is I get 'no current record' error instead of
'property not found'. Yet there definitely is a current record...

Can anyone at least offer a direction to solve?

Thanks


swas
 
B

BruceM

Have you compiled the code? Do you have error handling that shows what
event is producing the error? I know you said that if a line of code in
CheckMDBF is removed, the error stops, so I assume the error is in the
CheckMDBF function, but I don't know that for sure. In any case, it would
help knowing what line is generating the "Property not found" error. I
notice that you do not use the Me.MDBF.Undo syntax (you leave out the Me).
It may be worth trying the Me syntax. Also, if MDBF is both a control and a
field, Access could be getting confused when it tries to apply Undo to a
field rather than a control. Access contributes to this problem by using
the field name as the default control name for a text box, so it is up to
you to rename such text boxes.

What is MDBF? I assume it is a bound control such as combo box. Have you
tried changing:
If Not CheckMDBF Then
to
If CheckMDBF = False

Remember that we cannot see your database, and are not familiar with the
real-world situation you are trying to address. At a guess I would say this
has something to do with refilling fuel tanks, but even if that is true,
there is no way of knowing if MDBF is a field or a control, or what you mean
by "'MDBF will kick fill in before preschedule will". I am taking a stab
at the question because it has not received other responses after a couple
of days. My comments and suggestions of things to try are just things I
noted. I could not say why datasheet view specifically is causing problems.

In your follow-up post you say that the error message has changed. Do you
mean that the circumstances that produced "Property not found" now produce
"No current record"?

Have you tried Compact and Repair? If no luck there, you may as well export
everything to a new, blank database. It may be worth turning off Name
Auto-Correct when you do. This link has more information about that:
http://allenbrowne.com/bug-03.html
 
S

swas

BruceM,

Thanks for the detailed response.

I had tried the majority of your suggestions with no luck prior to posting.

MDBF is a field and control, and I hadn't tried renaming the text box - this
sounds like a possibility. I solved the problem by shifting the checking into
the form beforeupdate, so CheckMDBF only needs using once within this routine
(Rather than a function).

For what it is worth, it is tracking stocking. FillFrequency is prescheduled
stocks, with Max Days Between Fills an overriding maximum setting.

Thanks again.


swas
 

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