Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: R: Re: R: Re: R: Re: R: Re: hidding Tables


Message #1 by Bohus Peter <peter.bohus@l...> on Wed, 31 Jul 2002 12:48:00 +0200
Dear Brian,


my version ACCESS  SR-1 (I don't know what SR 1 means)
herein the code:

Option Compare Database
Option Explicit
' this modul gives oppurtinity to make tables hidden, it is necessary 
to go
' to immediate window and to type ?securedatabase and press enter

Public Function securedatabase()
Dim bolResult As Boolean

 bolResult =3D ChangePropertyDdl("AllowBypassKey", dbBoolean, False)
 bolResult =3D ChangePropertyDdl("AllowBreakIntoCode", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("StartupShowDBWindow", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("StartupShowStatusBar", dbBoolean, 
True)
 bolResult =3D ChangePropertyDdl("AllowBuiltinToolbars", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("AllowShortcutMenus", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("AllowBuiltInToolbars", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("AllowFullMenus", dbBoolean, False)
 bolResult =3D ChangePropertyDdl("AllowToolbarChanges", dbBoolean, 
False)
 bolResult =3D ChangePropertyDdl("AllowSpecialKeys", dbBoolean, False)

 End Sub


 Function ChangePropertyDdl(stPropName As String, _
  PropType As Variant, vPropVal As Variant) _
  As Boolean
  ' in the case of Access 2000 PropType must be daclered as 
DAO.DataTypeEnum
  ' Uses the DDL argument to create a property
  ' that only Admins can change.
  '
  ' Current CreateProperty listing in Access help
  ' is flawed in that anyone who can open the db
  ' can reset properties, such as AllowBypassKey
  '
     On Error GoTo ChangePropertyDdl_Err

     Dim db As DAO.Database
     Dim prp As DAO.Property

     Const conPropNotFoundError =3D 3265 ' in the case of Access2000 
this
constant 3270

     Set db =3D CurrentDb
     ' Assuming the current property was created without
     ' using the DDL argument. Delete it so we can
     ' recreate it properly
     db.Properties.Delete stPropName
     Set prp =3D db.CreateProperty(stPropName, _
      PropType, vPropVal, True)
     db.Properties.Append prp

     ' If we made it this far, it worked!
     ChangePropertyDdl =3D True

ChangePropertyDdl_Exit:
     Set prp =3D Nothing
     Set db =3D Nothing
     Exit Function

ChangePropertyDdl_Err:
     If Err.Number =3D conPropNotFoundError Then
         ' We can ignore when the prop does not exist
         Resume Next
     End If
     Resume ChangePropertyDdl_Exit
 End Function

 Best regards

peter





> -----Messaggio originale-----
> Da:	braxis@b... [SMTP:braxis@b...]
> Inviato:	mercoled=EC 31 luglio 2002 12.32
> A:	Access
> Oggetto:	[access] Re: R: Re: R: Re: R: Re: hidding Tables
>
> Peter
>
> Could you post the code you now have in your database, and let me 
know
> which version of Access the error is displayed in.
>
> Brian
>
> >  from:    Bohus Peter <peter.bohus@l...>
> >  date:    Wed, 31 Jul 2002 11:21:36
> >  to:      access@p...
> >  subject: Re: [access] R: Re: R: Re: R: Re: hidding Tables
> >
> > Brian
> >
> > Many thanks for your comments.
> >
> > Really I was surprised that in previous SecureDatabase function  
you did
> not
> > give any return value and  you terminated function with end sub. 
For
> that
> > reason I met immediately error in compiling.
> >
> > Well I applied all changes as you recommended in last two messages. 
Now
> I
> > got error message ERROR 13 (Type mismatch)
> >
> >
> > Best regards
> >
> > Peter
> >
>
>
>
Message #2 by braxis@b... on Wed, 31 Jul 2002 13:25:44 +0100 (BST)
Peter

Worked fine for me!?!

Can you mtell me which line produces the error?

Brian

>  from:    Bohus Peter <peter.bohus@l...>
>  date:    Wed, 31 Jul 2002 11:48:00
>  to:      access@p...
>  subject: Re: [access] R: Re: R: Re: R: Re: R: Re: hidding Tables
>
> Dear Brian,
>
>
> my version ACCESS  SR-1 (I don't know what SR 1 means)
> herein the code:
>
> Option Compare Database
> Option Explicit
> ' this modul gives oppurtinity to make tables hidden, it is necessary to 
go
> ' to immediate window and to type ?securedatabase and press enter
>
> Public Function securedatabase()
> Dim bolResult As Boolean
> 
>  bolResult =3D ChangePropertyDdl("AllowBypassKey", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("AllowBreakIntoCode", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("StartupShowDBWindow", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("StartupShowStatusBar", dbBoolean, True)
>  bolResult =3D ChangePropertyDdl("AllowBuiltinToolbars", dbBoolean, False
)
>  bolResult =3D ChangePropertyDdl("AllowShortcutMenus", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("AllowBuiltInToolbars", dbBoolean, False
)
>  bolResult =3D ChangePropertyDdl("AllowFullMenus", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("AllowToolbarChanges", dbBoolean, False)
>  bolResult =3D ChangePropertyDdl("AllowSpecialKeys", dbBoolean, False)
> 
>  End Sub
> 
>
>  Function ChangePropertyDdl(stPropName As String, _
>   PropType As Variant, vPropVal As Variant) _
>   As Boolean
>   ' in the case of Access 2000 PropType must be daclered as DAO.DataTypeE
num
>   ' Uses the DDL argument to create a property
>   ' that only Admins can change.
>   '
>   ' Current CreateProperty listing in Access help
>   ' is flawed in that anyone who can open the db
>   ' can reset properties, such as AllowBypassKey
>   '
>      On Error GoTo ChangePropertyDdl_Err
> 
>      Dim db As DAO.Database
>      Dim prp As DAO.Property
> 
>      Const conPropNotFoundError =3D 3265 ' in the case of Access2000 this
> constant 3270
> 
>      Set db =3D CurrentDb
>      ' Assuming the current property was created without
>      ' using the DDL argument. Delete it so we can
>      ' recreate it properly
>      db.Properties.Delete stPropName
>      Set prp =3D db.CreateProperty(stPropName, _
>       PropType, vPropVal, True)
>      db.Properties.Append prp
> 
>      ' If we made it this far, it worked!
>      ChangePropertyDdl =3D True
> 
> ChangePropertyDdl_Exit:
>      Set prp =3D Nothing
>      Set db =3D Nothing
>      Exit Function
> 
> ChangePropertyDdl_Err:
>      If Err.Number =3D conPropNotFoundError Then
>          ' We can ignore when the prop does not exist
>          Resume Next
>      End If
>      Resume ChangePropertyDdl_Exit
>  End Function
> 
>  Best regards
>
> peter
> 
>
>
>
>
> > -----Messaggio originale-----
> > Da:=09braxis@b... [SMTP:braxis@b...]
> > Inviato:=09mercoled=EC 31 luglio 2002 12.32
> > A:=09Access
> > Oggetto:=09[access] Re: R: Re: R: Re: R: Re: hidding Tables
> >
> > Peter
> >
> > Could you post the code you now have in your database, and let me know
> > which version of Access the error is displayed in.
> >
> > Brian
> >
> > >  from:    Bohus Peter <peter.bohus@l...>
> > >  date:    Wed, 31 Jul 2002 11:21:36
> > >  to:      access@p...
> > >  subject: Re: [access] R: Re: R: Re: R: Re: hidding Tables
> > >
> > > Brian
> > >
> > > Many thanks for your comments.
> > >
> > > Really I was surprised that in previous SecureDatabase function  you 
did
> > not
> > > give any return value and  you terminated function with end sub. For
> > that
> > > reason I met immediately error in compiling.
> > >
> > > Well I applied all changes as you recommended in last two messages. N
ow
> > I
> > > got error message ERROR 13 (Type mismatch)
> > >
> > >
> > > Best regards
> > >
> > > Peter
> > >
> >
> >
> >
>


  Return to Index