AfterUpdate - Default Value

rrueger

Registered User.
Local time
Today, 03:33
Joined
May 19, 2011
Messages
10
Hello,
Just starting to grasp concepts, need help filling in some holes. Using Access 2003. If I had a form, w/ 1 txt box (txtNum) and 1 combo box (cmbType) with values of RS and CS. I want the combo box to input a default value based on what the user inputs into the textbox (based on first number).

I'm trying to write, but dont know how. Here is my best explanation attempt using code/words

txtNum_AfterUpdate()
IF <<txtNum Value Starts with 1>> Then
cmbType.Defaultvalue = "RS"
ElseIF <<txtNum Value Starts with 2>> Then
cmbType.DefaultValue = "CS"
End IF
 
Code:
Private Sub txtNum_AfterUpdate()

Select Case Left(Me!txtNum, 1)
    Case 1
        Me!cmbType = "RS"
    Case 2
       Me!cmbType = "CS"
End Select

End Sub
 

Users who are viewing this thread

Back
Top Bottom