473,320 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 4452
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.supernews.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.OpenRecordset("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.supernews.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.Append tbl
....?

Thanks for your help,
Marie
<da********@lycos.co.uk> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.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(strTDFName 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(strTDFName)
Set fld = tdf.Fields(strFldName)

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
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...
3
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...
8
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.