Solved

Property not found error in BeforeUpdate event

Posted on 2009-07-07
5
725 Views
Last Modified: 2013-11-28
I am using Access 2007:

I am using Access 2007:

My problem has to do with BeforeUpdate Event associated with a textbox on a datasheet. following the Cancel = True code, the application brings up a dialog of Error 3270 Property not found.  It is not possible to trap for the error.  I even switched my setting in VBA to Break on All errors and it still will not stop to tell me where exactly the error is coming from.  Just wondering if anyone has any ideas.  My code (in the BeforeUpdate event of the text box) follows.


Dim Msg, Style, Title, Help, MyString, Response

    On Error GoTo Error_Trap

    If Me.txtNetWt = "" Then  'Continue on.  Do nothing

    Else

    

       

        Msg = "You are about to change a value that affects the Weight fields.  If you continue Qty and NetWt and GrosWT fields will be blanke." _

       & vbCrLf _

       & vbCrLf _

       & "Is this what you want?"

        Style = vbYesNo + vbDefaultButton2

        Title = "Question"

        Response = MsgBox(Msg, Style, Title)

        If Response = vbYes Then

         'continue on

        Else

            Me.txtSize.Undo

            Cancel = True

        End If

    End If

    

Exit_Error:

    Exit Sub

    

Error_Trap:

       

    If Err.Number = 3270 Then     'Property not found

       Resume Next

    Else

      MsgBox "Error #" & Err.Number & ": " & Err.Description & ". Wdy code. See brnRetrieve_Click "

      Resume Exit_Error

    End If

Open in new window

0
Comment
Question by:WoodrowA
  • 3
  • 2
5 Comments
 
LVL 39

Expert Comment

by:thenelson
ID: 24799776
Single step though the code to see what is creating the error.
0
 

Author Comment

by:WoodrowA
ID: 24799844
Thank you for responding.
As I tried to communicate in my original post, single stepping does not work.  Apparently the error happens after the end sub of the BeforeUpdate Event and Access gives no indication as to why or where or how.  Single stepping does not work.
0
 
LVL 39

Expert Comment

by:thenelson
ID: 24815585
Try remarking out the line:
On Error GoTo Error_Trap
and running the code.

If that doesn't display the error try decompiling/recompiling:
CREATE A BACKUP OF THE CORRUPT DATABASE. (Just in case)

decompile: in run: msaccess "dbPathName.mdb" /decompile
   Compact/repair:  in run: msaccess "dbPathName.mdb" /compact
   compile: in VB editor: debug> compile
   Compact/repair
   http://www.granite.ab.ca/access/decompile.htm

BTW: you can replace    
If Me.txtNetWt = "" Then  'Continue on.  Do nothing
    Else
...
End If
With
If Me.txtNetWt = "" Then  Exit Sub
It would be easier to follow also.
I would also change it to:
If Len(Me.txtNetWt & "") = 0 Then  Exit Sub
A few microseconds faster and traps Nulls also.
0
 

Accepted Solution

by:
WoodrowA earned 0 total points
ID: 24819606
Nelson,
I appreciate you responding.  I have tried your suggestions but the error remains.  I believe I have found a legitmate bug in Access 2007.  This error manifests itself when the form in question is in datasheet mode, and may be more likely to happen of the control is a text box.  When I run the same code in form view there is not problem.
I am aware of at least one other user who has experienced the same problem and it was delineated in UtterAccess.com.  However, no solution was found.  
0
 
LVL 39

Assisted Solution

by:thenelson
thenelson earned 500 total points
ID: 24824423
Perhaps as a work around, Youcan use the after update event and me.undo.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now