help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello helpers - I am new to this board and I am hoping you can help me.....

Is there a way that I can disable fields based on a previous selection of
another field.

For example I have got 5 tasks to be completed but depending on the customer
requirements (ie A, B, or C) depends on the tasks to be done
Route A = Tasks 1, 2, 3, 4
Route B = Tasks 1, 3, 4
Route C = Tasks 1, 5

I'd like to be able to have an option group for A, B, C and then for the
not-relevant fields to become greyed-out.

I am pretty good with Access but not too familiar with the jargon so if
anyone can help me, please keep it simple

Thanks a million
 
In The AfterUpdate Event Of The Option Group (Assuming controls Named
Task1..Task5)

Private Sub OptGroup_AfterUpdate()
Dim C As Access.Control
Dim i As Long

Select Case Me.OptGroup.Value
Case 1: 'A
For i = 1 To 5
Me.Controls("Task" & i).Enabled = (i <> 5)
Next
Case 2: 'B
For i = 1 To 5
Me.Controls("Task" & i).Enabled = (i <> 2) And (i<>5)
Next
Case 3: 'C
For i = 1 To 5
Me.Controls("Task" & i).Enabled = (i =1) Or (i=5)
Next
End Select

End Sub

Also (assuming you set a default value for the OptGroup):
Private Sub Form_Current()
OptGroup_AfterUpdate
End Sub

HTH

Pieter
 

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

Back
Top