Solved

Property not found error in BeforeUpdate event

Posted on 2009-07-07
5
729 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

820 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