422,530 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,530 IT Pros & Developers. It's quick & easy.

Enabling and disabling fields

P: 3
I have two field.
1) Angel
2) Devil
I want that if i fill ANGEL field with any text the DEVIL field should become disable or grey out. But if i left ANGEL field blank the DEVIL field should be enable to fill text.
Please healp.
1 Week Ago #1
Share this Question
Share on Google+
6 Replies


twinnyfo
Expert Mod 100+
P: 2,238
Jugnu,

This is probably a fairly straightforward solution. But in this forum, we expect posters to do the majority of the work. What have you tried so far? If you post your work and indicate where you are having difficulty, we can help troubleshoot for you.

I can guide you to a good starting point in that you will be working with the .Enable property of your controls.
6 Days Ago #2

NeoPa
Expert Mod 15k+
P: 30,680
Another little tip is to use both the Form_Current() and {Control}_AfterUpdate() event procedures.
6 Days Ago #3

PhilOfWalton
Expert 100+
P: 1,083
I would think very carefully about Disabling the fields. If for some reason (perhaps a bit of code working in the background) set text into both fields, everything gets disabled. By using the .Locked property and changing the colour, it would still be possible to Double Click the offending field to return it to "Normal"

Phil
6 Days Ago #4

NeoPa
Expert Mod 15k+
P: 30,680
I have to say I'm unconvinced by that logic. Only a fairly clumsy application would give you any possibility of a problem. That's always assuming you allow such a possibility to occur in the first place of course. I still see the .Enabled property as the most appropriate to use for the scenario as described.

On the other hand, it is a push towards handling that possibility in your logic.
6 Days Ago #5

PhilOfWalton
Expert 100+
P: 1,083
Completely with you that the enabled is the correct way to go. I am no expert (as you will have gathered) in multi user environments and don't know whether 2 users could change the record simultaneously to enter data into both fields.

If so, the very obvious Sub that fires on the AfterUpdate & OnCurrent could have an additional bit of code to deal with both fields having text in them.

Phil
6 Days Ago #6

NeoPa
Expert Mod 15k+
P: 30,680
It is possible, but only if you allow it. In a multi-user environment you would typically configure it to lock other users out when updating a record.
5 Days Ago #7

Post your reply

Sign in to post your reply or Sign up for a free account.