[AccessD] Set Read only on Form Load -

Nancy Lytle nancy.lytle at auatac.com
Fri Mar 28 09:59:58 CST 2003


Thanks for the help
I took your advice, Doris and Paul, and did the following

- Created a variable
Public pubCallingForm As String
is the Declarations section of a module I use for Global stuff

- On the form Open event I put

Public Sub Form_Open(Cancel As Integer)
pubCallingForm = ""  'resets the variable
pubCallingForm = "frmAdministration"
call fcnFormLoad
End Sub

-Created this function in the Globals module
Public Function fcnFormLoad()
       Call fcnUserGroup
       MsgBox pubCallingForm
        If fcnUserGroup = "RO" Then
          Forms(pubCallingForm).AllowAdditions = False
          Forms(pubCallingForm).AllowDeletions = False
          Forms(pubCallingForm).AllowEdits = False
       Else
          Forms(pubCallingForm).AllowAdditions = True
          Forms(pubCallingForm).AllowDeletions = True
          Forms(pubCallingForm).AllowEdits = True
       End If
    End Function

I appreciate the assistance, Paul got me going and Doris got me straight on
using Forms(variable).etc
Thanks again,
Nancy
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mike and Doris
Manning
Sent: Friday, March 28, 2003 8:40 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Set Read only on Form Load


Pass in the name of the form...

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

Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Nancy Lytle
Sent: Friday, March 28, 2003 08:28 AM
To: Accessd
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

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



More information about the AccessD mailing list