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. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|