Solved

Runtime Error 3421 in Access 2007

Posted on 2013-01-31
4
791 Views
Last Modified: 2013-01-31
My code saves the value from a textbox, but when there is no value, I want it to overwrite the value in the table (formatted as Long, no required value, and no index).  I tried the following 3 options:

1) If AEN.Value <> "" Then rs.AEN = AE.Value Else rs.[AE] = Null
2) If AEN.Value <> "" Then rs.AEN = AE.Value Else rs.[AE] = vbNull
3) If AEN.Value <> "" Then rs.AEN = AE.Value Else rs.[AE] = Nothing

Out of all 3 options, no error occur, but when I load the value back from the table into the textbox, the value '1' appears (in the textbot and in the record).  How can I modify my recordset statement to overwrite the current value in the record with nothing?
0
Comment
Question by:CCIG2006
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Anthony Berenguel earned 500 total points
ID: 38839872
Try
If AEN.Value <> "" Then rs.AEN = AE.Value Else rs.[AE] = Empty

Open in new window

If the textbox is bound to the same table that is the source for your recordset, then I believe you will need to refresh the form so that the value from the table (that we just updated through the recordset)  will display. And as you stated, if there is no value then nothing will display.
0
 

Author Comment

by:CCIG2006
ID: 38839914
It still returns the value '1'.
0
 

Author Comment

by:CCIG2006
ID: 38839920
actually, it worked (I was looking at the wrong field).  Thank you for your help.
0
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 38839923
Cool! I'm glad that I was able to help.
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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

863 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

21 Experts available now in Live!

Get 1:1 Help Now