W
Witchunter
Hi! I have a following problem:
I have a table called Dogs. It contains two fields, Class (textual,
represting dog class) and HasTail (Yes/No, representing if the dog has a
tail).
Next, I have a table called Tails. It contains only one field, Color
(textual, representing tail color).
Next, I have a form which I use to store some data in other table, which is
not relevant to all of this. On this form, I have placed two combo boxes.
One is always enabled, and it contains entries from table Dogs. It shows a
list of classes of dogs.
The second one is disabled by default, and should be enabled only if the
entry selected in the first one actually has a tail.
So lets say we have this in table Dogs:
Class HasTail
01. Labrador NO
02. Dalmatian YES
03. Puddle YES
04. Retriever NO
05. Bulldog NO
And this in table Tails:
Color
01. green
02. red
03. yellow
04. bluish
So, as I explained, I want to set second combo box enabled or disabled
depending on the choice selected in the first one.
I reckon the code would look something like this:
Private Sub Form_AfterUpdate()
Dim EntryHasTail As Boolean
Dim SomeObject As SomeObjectType // create some object
SomeObject = TableDogs.LookupEntryByName('Class', FirstComboBox.Text) //
assign object to entry in a table
EntryHasTail = SomeObject.HasTail // check if that entry has tail
SecondComboBox.Enabled = EntryHasTail
End Sub
Or is there a simpler solution to this?
How to find if an entry has a tail? Thanks in advance.
I have a table called Dogs. It contains two fields, Class (textual,
represting dog class) and HasTail (Yes/No, representing if the dog has a
tail).
Next, I have a table called Tails. It contains only one field, Color
(textual, representing tail color).
Next, I have a form which I use to store some data in other table, which is
not relevant to all of this. On this form, I have placed two combo boxes.
One is always enabled, and it contains entries from table Dogs. It shows a
list of classes of dogs.
The second one is disabled by default, and should be enabled only if the
entry selected in the first one actually has a tail.
So lets say we have this in table Dogs:
Class HasTail
01. Labrador NO
02. Dalmatian YES
03. Puddle YES
04. Retriever NO
05. Bulldog NO
And this in table Tails:
Color
01. green
02. red
03. yellow
04. bluish
So, as I explained, I want to set second combo box enabled or disabled
depending on the choice selected in the first one.
I reckon the code would look something like this:
Private Sub Form_AfterUpdate()
Dim EntryHasTail As Boolean
Dim SomeObject As SomeObjectType // create some object
SomeObject = TableDogs.LookupEntryByName('Class', FirstComboBox.Text) //
assign object to entry in a table
EntryHasTail = SomeObject.HasTail // check if that entry has tail
SecondComboBox.Enabled = EntryHasTail
End Sub
Or is there a simpler solution to this?
How to find if an entry has a tail? Thanks in advance.