Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

7 Control Situations

Status
Not open for further replies.

Neak1

Computer
Sep 10, 2001
12
0
0
US
Here is the situation,

I have 7 controls on this form. I am trying to find out what type of syntax to use in order to do the following.

The first controls label asks the question.
Is there a payment discrepancy? "Y" or "N" (are the two options for this 1 position control)

The other 6 controls will be filled in pairs of two if the answer is "Y". For example:

Field 2: Current Amount Field 3: Current Amount Effect
Field 4: Retro Amount Field 5: Retro Amount Effect
Field 6: Future Amount Field 7: Future Amount Effect

If the first field is filled in with a "Y" then Current Amount and Effect or Retro Amount and Effect or Future Amount and Effect must be filled in, one of the set of pairs must be code but not all pairs if the answer is "Y". There can not be missed march combinations of the filled control. Example: Current Amount and Retro Effect can not be filled in together. Current Effect and Retro AMount must also be filled in if this situation is to work. The amount and the effect must be coded together. There can't be Current Amount with a Currenct Amount Effect.

Amounts are dollar values, and Effects are Alpha characters.

I hope that this make it clear. I need to know what syntax to use to get the code to work as stated.

Please Help
Neaka
 
Replies continue below

Recommended for you

Hi,

Why not have grouped option buttons labled YES & NO for each pair of fileds.

Then depending on the state of the option button you either enable or disable the other fields and therefore allow/stop any user entry into those fields.

As an example
Is there a discrepancy O Yes O No
O Yes O No [Field 1] [Field 2]
O Yes O No [Field 3] [Field 4]
O Yes O No [Field 5] [Field 6]

each yes-no pair work together with each other but independent of the other pairs. However you may choose that the discrepancy O Yes O No enables or disables the other controls & fields depending on what you select. As can the other YES/NO controls.

To get the logic right you need to state all the conditions i.e. if first pair = yes then what must be enabled
if second pair = yes then what must be enabled

A sample piece of code for the above is

Private Sub Option1_Click()
Amount.Enabled = True
Effect.Enabled = True

Amount2.Enabled = True
effect2.Enabled = True
End Sub

Private Sub Option2_Click()
Amount.Enabled = False
Effect.Enabled = False

Amount2.Enabled = False
effect2.Enabled = False
End Sub



Where Option1 = YES button and Option2 = NO button of the Discrepancy question.

Selecting yes enables the other fields, selecting no disables them.

Any help ?, yes no let me know.

Regards
 
Status
Not open for further replies.
Back
Top