[AccessD] Setting default value of a text box

Stuart McLachlan stuart at lexacorp.com.pg
Wed Apr 3 15:39:23 CDT 2013


Nope, once you have done any entry into the record, changing the DefaultValue has no 
effect.   

The only time DefaultValue is used is when the first entry is started in any field in the record.

After that you have to set the actual value, not the Defaultvalue.



On 3 Apr 2013 at 18:43, Gustav Brock wrote:

> Hi Chester
> 
> You probably need a set of outer quotes:
> 
> Private Sub CompanyName_AfterUpdate()
>     Dim Company As String
>     Company = Me.CompanyName.Value
>     Me.[Invoice Number].DefaultValue = IIf(Company = "Renegade", Chr(34) &
> "RWLS" & Chr(34), "") 
> End 
> 
> /gustav
> 
> 
> -----Oprindelig meddelelse-----
> Fra: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] På vegne af Kaup, Chester
> Sendt: 3. april 2013 15:23
> Til: Access Developers discussion and problem solving
> Emne: Re: [AccessD] Setting default value of a text box
> 
> I tried placing the following code in the after update event of the text box
> Company Name but it seems to do nothing. This is the first text box on the
> form that accepts data. What am I doing wrong?
> 
> Private Sub CompanyName_AfterUpdate()
>     Dim Company As String
>     Company = Me.CompanyName.Value
>     Me.[Invoice Number].DefaultValue = IIf(Company = "Renegade", "RWLS",
> Null) 
> End Sub
> 
> 
> -- 
> 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