Solved

Runtime Error 3421 in Access 2007

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 importing text files 13 20
VBA script to check for duplicate primary keys on lost focus 18 29
Can not open the Access Help ? 3 53
Dlookup MSACCESS 5 24
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

786 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