connerlowen
Registered User.
- Local time
- Today, 09:40
- Joined
- May 18, 2015
- Messages
- 204
HI,
I have a form with only one field visible on open. I have a combo box "PartOrAssembly" that I want to determine what fields will be made visible. My code in the Form_Current()
Private Sub Form_Current()
Me.NumberOfParts.Visible = False
Me.NumberOfPreciousMetals.Visible = False
Me.NumberOfBaseMetals.Visible = False
Me.MinimumBatch.Visible = False
Me.NumberOfAssemblies.Visible = False
Me.NumberOfParts.Enabled = True
Me.NumberOfPreciousMetals.Enabled = True
Me.NumberOfBaseMetals.Enabled = True
Me.MinimumBatch.Enabled = True
Me.NumberOfAssemblies.Enabled = True
End Sub
My code in the PartOrAssembly_AfterUpdate()
Private Sub PartOrAssembly_AfterUpdate()
' test the value entered by user in the category field and hide fields as required
If Me.NewRecord Then
If Me.PartOrAssembly = "Assembly" Then
Me.NumberOfAssemblies.Visible = True
Else
Me.NumberOfParts.Visible = True
Me.NumberOfPreciousMetals.Visible = True
Me.NumberOfBaseMetals.Visible = True
Me.MinimumBatch.Visible = True
End If
End If
End Sub
When the "PartOrAssembly" combo box is updated the code jumps to the Else condition regardless of the selection. The first part of the If condition is not running. What do I need to do to prevent this?
Thanks, Conner
I have a form with only one field visible on open. I have a combo box "PartOrAssembly" that I want to determine what fields will be made visible. My code in the Form_Current()
Private Sub Form_Current()
Me.NumberOfParts.Visible = False
Me.NumberOfPreciousMetals.Visible = False
Me.NumberOfBaseMetals.Visible = False
Me.MinimumBatch.Visible = False
Me.NumberOfAssemblies.Visible = False
Me.NumberOfParts.Enabled = True
Me.NumberOfPreciousMetals.Enabled = True
Me.NumberOfBaseMetals.Enabled = True
Me.MinimumBatch.Enabled = True
Me.NumberOfAssemblies.Enabled = True
End Sub
My code in the PartOrAssembly_AfterUpdate()
Private Sub PartOrAssembly_AfterUpdate()
' test the value entered by user in the category field and hide fields as required
If Me.NewRecord Then
If Me.PartOrAssembly = "Assembly" Then
Me.NumberOfAssemblies.Visible = True
Else
Me.NumberOfParts.Visible = True
Me.NumberOfPreciousMetals.Visible = True
Me.NumberOfBaseMetals.Visible = True
Me.MinimumBatch.Visible = True
End If
End If
End Sub
When the "PartOrAssembly" combo box is updated the code jumps to the Else condition regardless of the selection. The first part of the If condition is not running. What do I need to do to prevent this?
Thanks, Conner