473,608 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

allowing null values in rst

What is the DAO method of allowing a recordset to have null values?

Thanks,
marie
Nov 13 '05 #1
6 4471
Not sure what you mean. Are you asking how an individual field can have Null
or not? That's a result of the Required property of the Field in the
TableDef object.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Modest Marsupial" <Ma*******@mbg. com> wrote in message
news:10******** *****@corp.supe rnews.com...
What is the DAO method of allowing a recordset to have null values?

Thanks,
marie

Nov 13 '05 #2
Are you having trouble reading data out of a recordset? Is that what
you mean?

David

Nov 13 '05 #3
Sorry about the lack of clarification. I need the entire recordset to be
able to accept null values so that when I update it, I don't get the error:
Run-time error '3314': The field cannot contain a Null value because the
Required property for this field is set to True. Enter a value in the
filed.'

I can't find how to set the Required property for the recordset to False.
Should it be at the end of this statement somewhere:
Set rst = dbs.OpenRecords et("tbl")

When I go to write the recordset to a table, it won't have null values. But
when I am updating the recordset and doing calculations on it, it sometimes
will. So I don't need the table to have the ability to have Null values,
just the recordset.

Thanks, marie

"Modest Marsupial" <Ma*******@mbg. com> wrote in message
news:10******** *****@corp.supe rnews.com...
What is the DAO method of allowing a recordset to have null values?

Thanks,
marie

Nov 13 '05 #4
Ahhhhh right,

You're almost there you're looking in the wrong place. Remember
recordsets essentially read data from tables (a nice simple way of
putting it), so allthough the error happens in your code with the
recordset - it doesn't mean this is the problem.

In order to pull this off you'll need to edit the table to accept the
null values.

Open up your table in design view, find the fields you want to be able
to set to null. If you look at the bottom of the screen you will see
they have a "Required" property. Make sure this is set to no.
Does that help you?

Dave

Nov 13 '05 #5
Okay, Dave! That would explain why when I finally figured out how to set
the recordset to allow nulls, I still got the same error....grrr.

But I don't want to edit the table in design view: The table has a variable
number of fields, and every time the client runs this program, the table
will change. So I need to do this automatically in my program. Do I do it
when I specify: Set tbl = New ADOX.Table or in cat.Tables.Appe nd tbl
....?

Thanks for your help,
Marie
<da********@lyc os.co.uk> wrote in message
news:11******** ************@c1 3g2000cwb.googl egroups.com...
Ahhhhh right,

You're almost there you're looking in the wrong place. Remember
recordsets essentially read data from tables (a nice simple way of
putting it), so allthough the error happens in your code with the
recordset - it doesn't mean this is the problem.

In order to pull this off you'll need to edit the table to accept the
null values.

Open up your table in design view, find the fields you want to be able
to set to null. If you look at the bottom of the screen you will see
they have a "Required" property. Make sure this is set to no.
Does that help you?

Dave

Nov 13 '05 #6
Using DAO:

Don't worry about the error I got major confused when I first
encountered it. I get the impression you have created some kind of make
table query? (Am I right?) If so you may need to make something to
cycle through the fields in the created table and run the below.

This piece of VBA will change any table you give it. It may be better
as a function - make sure you test it, as it's "air-code".

Sub SetRequired(str TDFName As String, strFldName As String, booSetVal
As Boolean)

Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim db As DAO.Database

Set db = CurrentDb
Set tdf = db.TableDefs(st rTDFName)
Set fld = tdf.Fields(strF ldName)

fld.Required = booSetVal
End Sub

Anyone else want to add a tuppence worth?

Dave

Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1774
by: D Witherspoon | last post by:
What is the accepted method of creating a data class or business rules object class with properties that will allow the returning of null values? For example... I have a class named CResults with the following properties. TestID int QuestionID int AnswerID int So, this is a simple example, but I want to be able to know if AnswerID is
3
5803
by: Rico | last post by:
Hello, I have a foreign key constraint between two tables (Appointments and MissedAppointmentReasons) and I'd like to allow null values in Appointments table for the field containing the MissedAppointmentReason, but currently, I get a Foreign Key Constraint Error when I try to add a record to the Appointments table. Any ideas how I can have the null values but still maintain the Foreign Key Constraint?
8
3676
by: DaFrizzler | last post by:
Hi, I have received the following email from a colleague, and am quite frankly baffled by the idea. I am just wondering if anyone has any advice or suggestions about this???? === BEGIN MAIL === The DB2 DBA has requested that all columns in the tables be defined as not null with default to improve storage, performance, and ease of
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3960
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.