Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Fields when Certain Tabs are chosen

Status
Not open for further replies.

ArcadeJr

MIS
Joined
Feb 28, 2002
Messages
6
Location
US
I have a form where on the top there are fields that are used for all the letters (reports) and on the bottom of the form there are seven tabs for each of the different types of letters (reports) that can be generated. I want to disable some fields on the top part when certain tabs are chosen. How do I do this?


Jerry :)

 
Jerry,

Without seeing your monitor, it's hard to determine what you're asking.

When you say "tab", if that is a button you could have an On Click event. In the code window, you'd just need to include

field1.visible = false
^^^^^ ^^^^^^^
your constant
field
name

If you'd prefer that field1 remain visible, just unuseable, you would want to look into the locked and enabled properties.

HTH,
Bob
 
I tried that with visible and it does not work. Here is what I did:

Tab name is called Collections and the field I want to disable is called RequestedBy.

I click on Collections tab and in the OnClick settings, I enter the following:

[RequestedBy].Visible = False

I try using the form and the RequestedBy field does not disappear.

I have tried the Enable command as well and does not work.

Any other ideas?

Jerry :)
 
When you say "tab", do you mean you have a tab panel in your program, or is this just what you are calling the command buttons. I am a little confused right now.
 
The tabs are also known as Tab Control. You get that when you click on the Formatting toolbar. The picutre looks like a folder with tabs on top. When you click on that, you are then able to create tabbed dialog boxes and have multiple pages. You can then right-click the page or tab and set up the properties for that page or tab.

Jerry :)
 
Go to your last tab, and then click to right of it. This way you will select the tab control itself, and not a panel. Try using the onChange event. Maybe it will give you want you are looking for.
 
Jerry,

I typed before my brain was operational...
(Hate when that happens!)

Setting the visible property for a control is typically performed as part of a form's On Load event. Your form is already open, so I suspect it doesn't appear to do anything.

To illustrate how I used it, the following is part of On Load code for a database I developed. When the main form is opened, a previously set flag is checked. If the user works in Human Resources, a button to call a data entry form is made visible, otherwise it's invisible.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FORM NAME"
DoCmd.OpenForm stDocName, , , stLinkCriteria


If Forms!fmnuEntry!chkHR = True Then
cmdDataEntry.Visible = True
else
cmdDataEntry.Visible = False
end if

So, I cannot guarantee your usage, but I think you'll need to close your form, set controls visible or invisible as you require, then reopen the form. For example,

DoCmd.CloseForm "Jerrys Form"
[RequestedBy].Visible = False
DoCmd.OpenForm "Jerrys Form"

No guarantee because I haven't done this.
And it's possible you can set the .visible property and
then just Me.Refresh to get it.

Good Luck!
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top