Solved

Property not found error in BeforeUpdate event

Posted on 2009-07-07
5
731 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

630 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