Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    159

    Unanswered: Another access question

    I have to modify a current database that is a form based on a table.
    I need to change it so that most users can read all the data and add new data but not delete others data. Then there has to be super users that can read and delete data. How best to go about that? If I set the form for data entry users cannot read back data. Suggestions?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    You need to set the AllowEdits, AllowDeletions and AllowAdditions properties either on form load or (to account for the "can delete their own but not others data") on current.

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    May 2004
    Posts
    159
    Thanks for the suggestions pootle.
    I decided to adapt some standard code we use to handle the security issue.

    Here is the code I used.



    Public Function Logon(username As String) As Boolean
    On Error GoTo err_handler
    Dim strLogin As String

    Dim intViewDbWind As Integer


    Logon = True
    strLogin = Environ("Username")
    username = strLogin



    Select Case strLogin

    Case "some user"
    intViewDbWind = _
    MsgBox("View Database Window next time Db is opened?", vbYesNo)

    Select Case intViewDbWind

    Case 6 ' vbYes


    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    'ChangeProperty "StartupShowStatusBar", dbBoolean, True
    'ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
    'ChangeProperty "AllowShortcutMenus", dbBoolean, True
    'ChangeProperty "AllowFullMenus", dbBoolean, True
    'ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    'ChangeProperty "AllowSpecialKeys", dbBoolean, True
    'ChangeProperty "AllowBypassKey", dbBoolean, True

    Case 7 ' vbNo

    'DisableToolbar
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    'ChangeProperty "StartupShowStatusBar", dbBoolean, False
    'ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    'ChangeProperty "AllowShortcutMenus", dbBoolean, False
    'ChangeProperty "AllowFullMenus", dbBoolean, False
    'ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    'ChangeProperty "AllowSpecialKeys", dbBoolean, False
    'ChangeProperty "AllowBypassKey", dbBoolean, False

    Case Else

    MsgBox "It is unclear if the Database window will show" & _
    "or not the next time the database is opened", vbOKOnly

    End Select


    Case Else

    'database window will be hidden next time app opens
    DisableToolbar
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    'ChangeProperty "StartupShowStatusBar", dbBoolean, False
    'ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    'ChangeProperty "AllowShortcutMenus", dbBoolean, False
    'ChangeProperty "AllowFullMenus", dbBoolean, False
    'ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    'ChangeProperty "AllowSpecialKeys", dbBoolean, False
    'ChangeProperty "AllowBypassKey", dbBoolean, False

    End Select

    err_handler:

    Resume Next

    End Function

    Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

    'used for changing database startup properties

    Dim dbs As DAO.Database, prp As DAO.Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

    Change_Bye:
    Exit Function

    Change_Err:
    If Err = conPropNotFoundError Then ' Property not found.
    Set prp = dbs.CreateProperty(strPropName, _
    varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next
    Else
    ' Unknown error.
    MsgBox Err.Description, vbOKOnly
    ChangeProperty = False
    Resume Change_Bye
    End If

    End Function




    Public Function DisableToolbar()

    With DoCmd

    .ShowToolbar "database", acToolbarNo
    .ShowToolbar "menu bar", acToolbarNo




    'InitApplication 'To disable the Close button on the title bar and Alt-F4 shutcut key
    End With

    'Dim barMenu As CommandBar
    'Dim barTool As CommandBar

    'Set barMenu = CommandBars("Menu Bar")
    'Set barTool = CommandBars("database")
    'barMenu.Visible = False
    'barTool.Visible = False

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •