Disabling and reenabling fields on form open

ZetecS

Registered User.
Local time
Today, 23:11
Joined
Nov 30, 2009
Messages
21
Hello,

I would like too know if it is possible to code a form so when it opens in add mode certain fields are disbaled and if it opens in edit mode then all fields are enabled.

Many thanks,
 
Are you going to open it in any other modes except those two? And are you doing it via the OpenForm command?
 
Well I have a switchboard that opens it in add mode only and then I have a command button within a password form that opens it up in for a better word normal mode (as if you click on it with in the main menu). Those would be the only way that it would be opened.
 
So you need something like this in the Load event of the form:
Code:
Me.[COLOR=Red]TextboxName[/COLOR].Enabled = Me.DataEntry
where TextboxName is the name of the control you would like to disable.

It would be worth checking that the form does not have focus before you try disabling it.

The logic is, if DataEntry is True it will enable it, if it's False it will disable it.
 
So you need something like this in the Load event of the form:
Code:
Me.[COLOR=red]TextboxName[/COLOR].Enabled = Me.DataEntry
where TextboxName is the name of the control you would like to disable.

It would be worth checking that the form does not have focus before you try disabling it.

The logic is, if DataEntry is True it will enable it, if it's False it will disable it.

Thanks for your reply it has worked but the other way to what I wanted it too. By that I mean the fields I would like disabled when the form is in add mode are enabled but when I want them enabled in "normal" mode they are disabled.

Any ideas?
 

Users who are viewing this thread

Back
Top Bottom