Solved

Runtime Error 3421 in Access 2007

Posted on 2013-01-31
4
796 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Autofill field with item description 6 54
ms access - Helpdesk ticket system 5 54
GA Ribbon creator 9 65
Unidentified Function 2 34
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
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…

710 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