Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Enabling Fields in Forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
T.Kay - 01 Jun 2007 17:19 GMT
I have a combobox valuelist field that is needs to be enabled in my subform
when another field is selected (Yes/No)

Eg:
If [Field A] = true then [Field B] = enabled otherwise [Field B] is not
enabled

I'm pretty sure of the If statement, but I'm confused as to where this code
should be built  Field A or Field B.

Do this type of validation rule have to be copied to the table design as well?

Thanks in advance...

T
Steve - 01 Jun 2007 18:28 GMT
Actually, you hasve to put code in two places ---
1.  Put the following code in FieldA AfterUpdate event:
   If Me!FieldA = True Then
       Me!FieldB.Enabled  = True
   Else
       Me!FieldB.Enabled  = False
   End If

2.  Put the same code in the form's On Current event.

You need to do 2 so correctly enable FieldB when the form opens and when you
navigate through records.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com

>I have a combobox valuelist field that is needs to be enabled in my subform
> when another field is selected (Yes/No)
[quoted text clipped - 13 lines]
>
> T
T.Kay - 01 Jun 2007 20:03 GMT
There is still an issue with the latter half of the code
Me!FieldB.Enabled=False is coming up as an error in the (On Current)

1. Does it matter that this is a subform of a main form?
2. Does it matter whether the Enabled Property for FieldB is already set at
yes or no?


> Actually, you hasve to put code in two places ---
> 1.  Put the following code in FieldA AfterUpdate event:
[quoted text clipped - 31 lines]
> >
> > T
Steve - 02 Jun 2007 00:48 GMT
It sounds like you put the code in the main form's On Current when you
really need to put it in the subform's On Current event. If that does not
work, are FieldA and FieldB on the main form or subform?

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com

> There is still an issue with the latter half of the code
> Me!FieldB.Enabled=False is coming up as an error in the (On Current)
[quoted text clipped - 42 lines]
>> >
>> > T
Maurice - 01 Jun 2007 18:50 GMT
In addition to steve's reply you can also put it in one line:

me![fieldB].enabled= not me![fieldA]

but indeed place it in the two sections steve mentioned

hth
Signature

Maurice Ausum

> I have a combobox valuelist field that is needs to be enabled in my subform
> when another field is selected (Yes/No)
[quoted text clipped - 11 lines]
>
> T
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.