shorten code

bigmac

Registered User.
Local time
Yesterday, 21:24
Joined
Oct 5, 2008
Messages
302
hi all, please can you help, the code below works ok but how do I make it smaller , it looks very long at the moment and there must be a way to make it look better.
cheers for looking.

'If lngMyEmpID = 2 Then
'Me.ShortcutMenu = False
'Me.WPQ_record_number.Enabled = False
'Me.WPS_record_number.Enabled = False
'Me.WPQ_link.Enabled = False
'Me.process.Enabled = False
'Me.Welding_code.Enabled = False
'Me.witnessing_class.Enabled = False
'Me.Test_date.Enabled = False
'Me.pdf_printed.Enabled = False
'Me.signed.Enabled = False
'Me.prolongation_reports.Enabled = False
'Me.position.Enabled = False
'Me.qualified.Enabled = False
'Me.p_number.Enabled = False
'Me.group_number.Enabled = False
'Me.material_spec.Enabled = False
'Me.common_name.Enabled = False
'Me.status.Enabled = False
'Me.SIX_month_update.Enabled = False
'Me.SIX_month_update.Enabled = False
'Me.TWELVE_month_update.Enabled = False
'Me.EIGHTEEN_month_update.Enabled = False
'Me.TWENTY_FOUR_month_update.Enabled = False
'End If
 
What is that you are trying to do? Simply looking at the code I guess there is no way to shorted this. Explain a bit what you want to achieve, maybe there is some other way !
 
hi pr2-eugin, all of the above are text boxes and what I am trying to do is stop them being written to by the user who's lngMyEmpID is 2
 
Do you wish the Form to be uneditable for a particular user? Or is it a matter of having a few controls locked?
 
both, some users will only be able to access certain text boxes, they will be viable but not editable
 
You need to be more organised with your thought. If it is making the form uneditable then you can open the form itself as ReadOnly thus no edits, if it is making a few controls locked, then you can make use of the Tag property and looping through the controls in the form, and lock it accordingly.
 
thanks mate, think you are right , will try the read only route
 

Users who are viewing this thread

Back
Top Bottom