Solved

Ms Access - After Update function on drop down

Posted on 2008-10-03
10
601 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
 

Author Comment

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

Expert Comment

by:Rey Obrero
ID: 22635187
instead of using

 text1.setfocus
 text1.Text = ""

try just using

     me.text1=""
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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 utilizing SQL Server stored procedures 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 Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

705 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

20 Experts available now in Live!

Get 1:1 Help Now