Skip address field if previous field is blank

Access Discussion in 'Microsoft Office' started by George Sinner, Nov 3, 2017.

  1. George Sinner

    George Sinner

    Joined:
    Nov 3, 2017
    Likes Received:
    0
    I have an access 2007 database that has fields for several addresses. I would like to have access skip subsequent address fields if the previous field is blank. I have done this before but for the life of me cannot remember how it was done. Thanks.
     
    George Sinner, Nov 3, 2017
    #1
    1. Advertisements

  2. George Sinner

    Shafiu

    Joined:
    Nov 4, 2017
    Likes Received:
    1

    You could try a code such as the following:

    Private Sub Form_Load()
    Me.txtField2.Enabled = False
    Me.txtField3.Enabled = False
    End Sub

    Private Sub Form_AfterInsert()
    Me.txtField2.Enabled = False
    Me.txtField3.Enabled = False
    End Sub

    Private Sub txtField1_AfterUpdate()
    If Me.txtField1.Value = "" Then
    Me.txtField2.Enabled = False
    Me.txtField3.Enabled = False

    Else
    Me.txtField2.Enabled = True
    Me.txtField3.Enabled = True

    End If

    End Sub
     
    Shafiu, Nov 5, 2017
    #2
    Ian likes this.
    1. Advertisements

  3. George Sinner

    George Sinner

    Joined:
    Nov 3, 2017
    Likes Received:
    0
    Thank you, will try tonight
     
    George Sinner, Nov 9, 2017
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.