Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Ms Access - After Update function on drop down

Posted on 2008-10-03
10
Medium Priority
?
610 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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 - Microsoft MVP, Access and Data Platform) earned 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

963 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