Solved

Runtime Error 3421 in Access 2007

Posted on 2013-01-31
4
785 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

17 Experts available now in Live!

Get 1:1 Help Now