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

x
?
Solved

Runtime Error 3421 in Access 2007

Posted on 2013-01-31
4
Medium Priority
?
801 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 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

972 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