PC Review


Reply
Thread Tools Rate Thread

Changing null to "" in a form field.

 
 
LAS
Guest
Posts: n/a
 
      4th Jul 2010
What is the recommended way to make sure that when the contents of an
unbound field are deleted, the contents will contain an empty string instead
of null?

TIA
LAS


 
Reply With Quote
 
 
 
 
Ken Snell
Guest
Posts: n/a
 
      4th Jul 2010
You could use the AfterUpdate event of the control:

Private Sub NameOfControl_AfterUpdate()
If Len(Me.NameOfControl.Value & "") = 0 Then Me.NameOfControl.Value = ""
End Sub

or

Private Sub NameOfControl_AfterUpdate()
Me.NameOfControl.Value = Nz(Me.NameOfControl.Value, "")
End Sub

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"LAS" <(E-Mail Removed)> wrote in message
news:i0qq8j$vbi$(E-Mail Removed)...
> What is the recommended way to make sure that when the contents of an
> unbound field are deleted, the contents will contain an empty string
> instead of null?
>
> TIA
> LAS
>



 
Reply With Quote
 
LAS
Guest
Posts: n/a
 
      5th Jul 2010
Thanks much!

"Ken Snell" <(E-Mail Removed)> wrote in message
news:i0r05i$uc5$(E-Mail Removed)...
> You could use the AfterUpdate event of the control:
>
> Private Sub NameOfControl_AfterUpdate()
> If Len(Me.NameOfControl.Value & "") = 0 Then Me.NameOfControl.Value = ""
> End Sub
>
> or
>
> Private Sub NameOfControl_AfterUpdate()
> Me.NameOfControl.Value = Nz(Me.NameOfControl.Value, "")
> End Sub
>
> --
>
> Ken Snell
> http://www.accessmvp.com/KDSnell/
>
>
>
> "LAS" <(E-Mail Removed)> wrote in message
> news:i0qq8j$vbi$(E-Mail Removed)...
>> What is the recommended way to make sure that when the contents of an
>> unbound field are deleted, the contents will contain an empty string
>> instead of null?
>>
>> TIA
>> LAS
>>

>
>



 
Reply With Quote
 
David W. Fenton
Guest
Posts: n/a
 
      5th Jul 2010
"Ken Snell" <(E-Mail Removed)> wrote in
news:i0r05i$uc5$(E-Mail Removed):

> You could use the AfterUpdate event of the control:
>
> Private Sub NameOfControl_AfterUpdate()
> If Len(Me.NameOfControl.Value & "") = 0 Then
> Me.NameOfControl.Value = "" End Sub


I don't understand this, since it's going to set the value to a ZLS
when it's already a ZLS. You only need to do it when it's Null:

If IsNull(Me!NameOfControl) Then
Me!NameOfControl = vbNullString
End If

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the "From" field when sending emails via an Access form dannyrblock Microsoft Access Form Coding 5 12th Jun 2008 04:08 PM
Records with "null" field "drop thru" query John Gilchrist Microsoft Access Queries 2 1st Mar 2006 06:59 PM
Why does my "form" delete my info after changing a field? =?Utf-8?B?TG9sYQ==?= Microsoft Word Document Management 1 22nd Jul 2005 10:23 PM
I want to check a field of table is "Null" or "Empty" in Access'03 =?Utf-8?B?QW5lc2g=?= Microsoft Access Macros 5 7th Dec 2004 01:24 PM
Running function which gets a form parameter type + Reseting existing field's parameter to null or "" Amir Microsoft Access Form Coding 1 7th Aug 2004 01:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:01 AM.