Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Property not found error in BeforeUpdate event

Posted on 2009-07-07
5
Medium Priority
?
735 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 2000 total points
ID: 24824423
Perhaps as a work around, Youcan use the after update event and me.undo.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

715 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