Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2003
    Posts
    104

    Unanswered: Preventing manual insertion into a table (when some condition exists)?

    Hi All,
    I am designing a form for the database, and there are two boxes for date created, date suspended.

    The problem is i need to be able to prevent a user form going into the tables and manually inserting a table when date suspended < date created (for example when date suspended is: october 14th and date created is October 29th).

    Any idea how this can be done?

    NOTE: In one of the tables, there are 2 feilds (DATE CREATED, and DATE SUSPENDED of data type "date")

  2. #2
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    If they ahve access to the tables, they can do whatever they want. I run mde's with menus that do not allow the use of the Database Window. THis helps.

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    I agree with jmrSudbury ... Another method is to split the DB into front-end and back-end ... There is a problem tho ... If you link in the table(s) then that is the same as having them in the FE anyways (complete access) ... What I do is have a BE and then use ADO for data manipulation ...

  4. #4
    Join Date
    Nov 2003
    Posts
    104
    Well I am working on a GUi front end, which the "user" is supposed to use exclusively for all operations. the problem is, as it stands, the user has full access. He/she can easily get into the tables and mess with them. I do not know how to "hide" them form the regular user

  5. #5
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    32

    Smile

    I use VBA to set the database start up properties, for ADMIN or USER.

    When I upload the front-end, it is in USER mode. If I need to make changes, I run the ADMIN sub, make changes, run USER sub then upload new client. See code below, HTH.

    Sub SetStartupPropertiesAdmin()
    Const DB_Text As Long = 10
    Const DB_Boolean As Long = 1
    ChangeProperty "StartupForm", DB_Text, "frmMainMenu"
    ChangeProperty "StartupShowDBWindow", DB_Boolean, True
    ChangeProperty "StartupShowStatusBar", DB_Boolean, True
    ChangeProperty "AllowBuiltinToolbars", DB_Boolean, True
    ChangeProperty "AllowFullMenus", DB_Boolean, True
    ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
    ChangeProperty "AllowShortcutMenus", DB_Boolean, True
    End Sub

    Sub SetStartupPropertiesUser()
    Const DB_Text As Long = 10
    Const DB_Boolean As Long = 1
    ChangeProperty "StartupForm", DB_Text, "frmSplashScreen"
    ChangeProperty "StartupShowDBWindow", DB_Boolean, False
    ChangeProperty "StartupShowStatusBar", DB_Boolean, False
    ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
    ChangeProperty "AllowFullMenus", DB_Boolean, False
    ChangeProperty "AllowBreakIntoCode", DB_Boolean, False
    ChangeProperty "AllowShortcutMenus", DB_Boolean, False
    End Sub

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

    Dim dbs As Object, prp As Variant
    Const conPropNotFoundError = 3270

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


    Exit_ChangeProperty:
    Exit Function


    Err_ChangeProperty:
    If Err = conPropNotFoundError Then
    Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next
    Else
    ' unknown error
    ChangeProperty = False
    Resume Exit_ChangeProperty
    End If

    End Function

  6. #6
    Join Date
    Nov 2003
    Posts
    104
    Thanx. I skimmed over your code. However, where do you call your Subs and functions from? Would it be frmSomeForm_Load ?
    Just curious.

    Thanx

  7. #7
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    32
    Originally posted by shassouneh
    Thanx. I skimmed over your code. However, where do you call your Subs and functions from? Would it be frmSomeForm_Load ?
    Just curious.

    Thanx
    The subs / functions are in a module not a form or other object.

    I run them by pressing ALT+F11 to start the VBA window and then run the sub.

    Not too worried about a user playing with code, most users here have a basic level of computer literacy.

  8. #8
    Join Date
    Nov 2003
    Posts
    104

    module?

    Sorry, I am still new to this VB talk. I am a C/C++ guy myself. Would do you mena they are in a module? Could you please elaborate on what this means?

Posting Permissions

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