[AccessD] Set Read only on Form Load

paul.hartland at fsmail.net paul.hartland at fsmail.net
Fri Mar 28 07:35:10 CST 2003


Nancy,

You could try something similar to the following.

1.  Create a new module
2.  Declare a public variable something like pubCallingForm
3.  In the OnOpen or OnLoad event put pubCallingForm = "frmName" (frmName being the name of your form)
4.  put you code into a module with the following changes
    Public Function fcnFormLoad()
       Call fcnUserGroup
       If fcnUserGroup = "RO" Then
          Forms!pubCallingForm.AllowAdditions = False
          Forms!pubCallingForm.AllowDeletions = False
          Forms!pubCallingForm.AllowDesignChanges = False
          Forms!pubCallingForm.AllowEdits = False
       Else
          Forms!pubCallingForm.AllowAdditions = True
          Forms!pubCallingForm.AllowDeletions = True
          Forms!pubCallingForm.AllowDesignChanges = True
          Forms!pubCallingForm.AllowEdits = True
       End If
    End Function

I have used something similar to the above, but can't find the exact code, this is off the top of my head and untested, but should get you in the right direction.

Paul


    


From: "Nancy Lytle" <nancy.lytle at auatac.com>
Date: Fri 28/Mar/2003 13:28 GMT
To: "Accessd" <accessd at databaseadvisors.com>
Subject: [AccessD] Set Read only on Form Load

Is it possible to create a function, like what I have below so that the code
can be stuck in the On Load or On Open event of any form I want?  Obviously
the Me is the problem here but I'm not sure the easiest way to go about
this.

Thanks in advance for any guidance.

Nancy Lytle

Current code attempt:

Public Function fcnFormLoad()
Call fcnUserGroup
If fcnUserGroup = "RO" Then
Forms!Me.AllowAdditions = False
Forms!Me.AllowDeletions = False
Forms!Me.AllowDesignChanges = False
Forms!Me.AllowEdits = False
Else
Forms!Me.AllowAdditions = True
Forms!Me.AllowDeletions = True
Forms!Me.AllowDesignChanges = True
Forms!Me.AllowEdits = True
End If
End Function

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


__________________________________________________________________________
Join Freeserve http://www.freeserve.com/time/

Winner of the 2003 Internet Service Providers' Association awards for Best Unmetered ISP and Best Consumer Application.




More information about the AccessD mailing list