[AccessD] Setting default value of a text box

Gustav Brock gustav at cactus.dk
Wed Apr 3 11:43:03 CDT 2013


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 Sub

/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




More information about the AccessD mailing list