If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > How to disable/hide/lock controls

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-03, 14:26
jazz novice jazz novice is offline
Registered User
 
Join Date: Feb 2003
Posts: 65
Question How to disable/hide/lock controls

I think I know the general rules, however for some reason it doesn't work for me.

I have a MainForm and a SubForm. On the Subform I have several controls some of which are "Program" related and some - "Course" related. As a rule if there are any entries in the "Program"related fields, there should not be any records in the "Course"related fields and visa-versa.

To solve this I am trying to do the following:

On the first "Program" related control useing the OnExit event I check if the value is Null and if not, then - lock/hide all the "Course" related controls. Here is the code I use:

------CODE BEGINS--------
'-- check if there is any entry for "ProgramId". If "Yes", then-------
'-- do not allow to enter any values that are only Course related ---------

If Not IsNull(Me.ProgramId) Then
Me.CourseId.Locked = True
'or
Me.CourseId.Visible = False
Else: End If
-------END OF CODE----

None of these seems to work.

.visible = False does not hide the control. Is this because it is on a SubForm?

.Locked = True still lets me to go into the control and enter values.

Any ideas how to solve this problem would be appreciated.
Thanks,
Jazz
Reply With Quote
  #2 (permalink)  
Old 05-18-03, 22:32
billjov billjov is offline
Registered User
 
Join Date: Nov 2002
Location: Melbourne
Posts: 92
This is just a suggestion , try this

If Not IsNull(Me.ProgramId) Then
Me.CourseId.Locked = True
Else
Me.CourseId.Visible = False
End If
Reply With Quote
  #3 (permalink)  
Old 05-19-03, 00:28
billjov billjov is offline
Registered User
 
Join Date: Nov 2002
Location: Melbourne
Posts: 92
OR


If Not IsNull(Me.ProgramId) Then
Me.CourseId.Locked = True
Me.CourseId.Visible = False
Else
Me.CourseId.Locked = False
Me.CourseId.Visible = True
End If

There might be others out there that might have a better solution.

Last edited by billjov; 05-19-03 at 00:31.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On