[AccessD] Insert Into with Null Fields

Jennifer Gross jengross at gte.net
Sun Nov 11 14:41:33 CST 2007


Hi Dan,

Perhaps setting the Allow Nulls property of the field in the table to
true will work.

Jennifer

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Sunday, November 11, 2007 12:10 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Insert Into with Null Fields


Hi Susan,

If IsNull(txtA) then
	Stg = "INSERT INTO tblMain ( B, C )" _
		& " VALUES ('" & txtB & "', '" & txtC & "')"
Else
	Stg = "INSERT INTO tblMain ( A, B, C )" _
		& " VALUES ('" & txtA & "', '" & txtB & "', '" & txtC &
"')" End If

Trying to insert a Null value creates an error.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Sunday, November 11, 2007 1:49 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Insert Into with Null Fields



> Sometimes when I write an INSERT INTO string, I have to take into 
> account that a text box or memo field might be null.  If there is one 
> possibility of a Null, I have to write and choose from 2 different 
> strings, if there are two possibilities of Null fields, then I have to

> write and choose from 4 different strings, and so on.
>
> Is there a way out of this?

=========I don't understand the need for mutliple statements. Can you 
provide a simple example?

Susan H. 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list