A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

default value for a form field



 
 
Thread Tools Display Modes
  #11  
Old July 13th, 2009, 07:06 PM posted to microsoft.public.access
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default default value for a form field

Hi Douglas,

That was precisely my point--that it is a string. You need to make
sure you are assigning a string, whether explicit or implicit. And if you
simply assign a value of a field as the default value to another field, you
need to deal with the times when that value may be null. Now, maybe the
easiest method would be to use the Nz() function rather than what I
originally suggested, which was bad due to the use of Default instead of
DefaultValue.

Text6.DefaultValue = Nz([Text5], "")

The fatigue level was rather high last week so my thinking level was
such that I probably should not have been trying to help people. Perhaps I
should quit before I get myself into a bigger hole :-)

Clifford Bass

"Douglas J. Steele" wrote:

Try

Text6.DefaultValue = "Null"

Regardless of what the Default Value is (i.e. Text, Number, Date, etc.), the
DefaultValue property is a string.


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

  #12  
Old July 13th, 2009, 10:17 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default default value for a form field

Technically, I believe that should be

Text6.DefaultValue = Chr$(34) & Nz([Text5], "") & Chr$(34)

just as it should be

Text8.DefaultValue = Chr$(34) & Nz([Text7], 0) & Chr$(34)

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


"Clifford Bass" wrote in message
...
Hi Douglas,

That was precisely my point--that it is a string. You need to make
sure you are assigning a string, whether explicit or implicit. And if you
simply assign a value of a field as the default value to another field,
you
need to deal with the times when that value may be null. Now, maybe the
easiest method would be to use the Nz() function rather than what I
originally suggested, which was bad due to the use of Default instead of
DefaultValue.

Text6.DefaultValue = Nz([Text5], "")

The fatigue level was rather high last week so my thinking level was
such that I probably should not have been trying to help people. Perhaps
I
should quit before I get myself into a bigger hole :-)

Clifford Bass

"Douglas J. Steele" wrote:

Try

Text6.DefaultValue = "Null"

Regardless of what the Default Value is (i.e. Text, Number, Date, etc.),
the
DefaultValue property is a string.


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



  #13  
Old July 14th, 2009, 12:44 AM posted to microsoft.public.access
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default default value for a form field

Hi Douglas,

You are right. And I really should quit. But nah... Here goes...
And it really should, for text values, be:

Text6.DefaultValue = Chr$(34) & Replace(Nz([Text5], ""), Chr$(34), Chr$(34)
& Chr(34)) & Chr$(34)

Or, slightly shorter version:

Text6.DefaultValue = """" & Replace(Nz([Text5], ""), """", """""") & """"

Clifford Bass

"Douglas J. Steele" wrote:

Technically, I believe that should be

Text6.DefaultValue = Chr$(34) & Nz([Text5], "") & Chr$(34)

just as it should be

Text8.DefaultValue = Chr$(34) & Nz([Text7], 0) & Chr$(34)

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

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.