Solved

Ms Access - After Update function on drop down

Posted on 2008-10-03
10
603 Views
Last Modified: 2013-11-28
hi,
I have a simple piece of code which clears my text field after I update my drop down box. Simply;
text1.setfocus
text1.Text = ""
This looks to run ok, but when the function hits "End" I get the following error;
"This macro or function set to the BeforeUpdate or ValidationRule preporty for this field is preventing Microsoft Access from saving the data in the field"

Any help?

0
Comment
Question by:andyb7901
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 22633951
Check the design of underlying table, looking at the properties of the field that Text1 is bound to.

Is sounds like you have set the Allow Zero Length property to "no".
0
 

Author Comment

by:andyb7901
ID: 22634148
Everything looks ok with the text box? I even created a brand new one to see if anything helped, but still same problems?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 22634335
<Everything looks ok with the text box?>

Did you check the actual field properties (not the textbox properties) in the table itself, per my previous post?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:andyb7901
ID: 22634380
Its not bound to any table? I am using no table?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 22635187
instead of using

 text1.setfocus
 text1.Text = ""

try just using

     me.text1=""
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 22635866
"This macro or function set to the BeforeUpdate "

Are you SURE you have this code in the *AfterUpdate()* event ??? That error typically occurs when you try to change a value in the Before Update event (which you cannot) ... and this error message implies!

Also, I highly recommend (in the AfterUpdate or elsewhere) you use:

 text1.setfocus
 text1.Text = Null

to avoid any issue with Zero Length String property set to No (as mbizup mentioned) - which it *should* be.

mx
0
 
LVL 61

Expert Comment

by:mbizup
ID: 22636987
andyb7901,

Can we see a sample of this database?  Leave out any personal or otherwise sensitive data.  

It's entirely possible that there is code in another event or some property setting that has not been mentioned here causing this issue.
0
 
LVL 75
ID: 22637981
Ah ha ... a new Icon - I read about that in the Newsletter. Kind of silly - why not REAL pix ?

mx
0
 
LVL 61

Expert Comment

by:mbizup
ID: 22637998
That would be nice, eh?
0
 
LVL 75
ID: 22638014
Kind of a NO Brainer !!  Your new icon looks like you have a leisure suit on, lol !

mx
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

786 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