Access Skip address field if previous field is blank

Joined
Nov 3, 2017
Messages
2
Reaction score
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.
 
Joined
Nov 4, 2017
Messages
2
Reaction score
1
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.


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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top