none
Auto populate an Access form text box RRS feed

  • Question

  • Hi everyone
     
    I have a user form called frmOrders in Access. Within the user form there is a yes/no combo box called cmbCredit. This is followed by a text box called txtScore. I would like some code that will automatically populate the txtScore field with N/A if the no option is selected from the cmbCredit box. I would also like the focus to then move to the next text box on the form txtContractManager as the txtScore is not required to be completed. If yes is selected from cmbCredit then the focus should move to the txtScore field following the usual tab order.
     
    I hope someone can help.
     
    BO
    Tuesday, March 18, 2014 3:54 PM

Answers

  • Use the combobox's AfterUpdate event.

    Private Sub cmbCredit_AfterUpdate()
    	If Me.cmbCredit = "No" Then
    		Me.txtScore = "N/A"
    		Me.txtContractManager.SetFocus
    	End If
    End Sub


    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered

    • Marked as answer by ByronOne Tuesday, March 18, 2014 7:12 PM
    Tuesday, March 18, 2014 3:58 PM

All replies

  • Use the combobox's AfterUpdate event.

    Private Sub cmbCredit_AfterUpdate()
    	If Me.cmbCredit = "No" Then
    		Me.txtScore = "N/A"
    		Me.txtContractManager.SetFocus
    	End If
    End Sub


    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered

    • Marked as answer by ByronOne Tuesday, March 18, 2014 7:12 PM
    Tuesday, March 18, 2014 3:58 PM
  • Thanks so much for this - really helpful - I will give it a go now...

    BO


    BO

    Tuesday, March 18, 2014 7:12 PM