[AccessD] Initial Settings Used to be Changing Table Names

Bill Patten bill_patten at embarqmail.com
Wed Mar 11 12:51:52 CDT 2009


Max,

Some times you have to create the property, here is the code MS provided 
(I've had it so long I think it was MS)

Function ChangeProperty(pstrPropName As String, pvarPropType As Variant, 
pvarPropValue As Variant) As Integer
' ----------------------------------------------------------------------------
' Purpose:
' By:       Bill Patten, BPCS
' Date:     3/04/2001 10:50:50 AM
' Mods:
' ----------------------------------------------------------------------------
' Comments  :
' Parameters: pstrPropName
'             pvarPropType
'             pvarPropValue -
' Returns   : Integer -
' Modified  :
'
' --------------------------------------------------
  Dim dbs As Database
  Dim prp As Property
  Const conPropNotFoundError = 3270

  Set dbs = CurrentDb
  On Error GoTo Change_Err
  dbs.Properties(pstrPropName) = pvarPropValue
  ChangeProperty = True

Change_Bye:
  Exit Function

Change_Err:
  If Err = conPropNotFoundError Then  ' Property not found.
    Set prp = dbs.CreateProperty(pstrPropName, pvarPropType, pvarPropValue)
    dbs.Properties.Append prp
    Resume Next
  Else
    ' Unknown error.
    ChangeProperty = False
    Resume Change_Bye
  End If
End Function


----- Original Message ----- 
From: "Max Wanadoo" <max.wanadoo at gmail.com>
To: "'Access Developers discussion and problem solving'" 
<accessd at databaseadvisors.com>
Sent: Wednesday, March 11, 2009 10:45 AM
Subject: Re: [AccessD] Initial Settings Used to be Changing Table Names


Thanks Bill, but why is my code not pulling it out of the dbs properties?

I am obviously off at a tangent here.

Max



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Patten
Sent: 11 March 2009 17:40
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Initial Settings Used to be Changing Table Names

By pass is I don't use autoexec macro so don't have to kill it.

AllowBypassKey

Bill


----- Original Message ----- 
From: "Max Wanadoo" <max.wanadoo at gmail.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Wednesday, March 11, 2009 10:33 AM
Subject: Re: [AccessD] Initial Settings Used to be Changing Table Names


Bob,

> The discussed Auto-Correct was at the top of the list.

I am trying to find out what the names of all these Initial Settings are so
that I can programmatically change them.
Below is some code I have run but it doesn't appear to have this one and
also, I cannot find the one that allows users to bypass the startup Autoexec
by holding down the shift key.

Anybody have some code to extract them please?

Max

Option Compare Database
Option Explicit

Function getdbprps()
On Error Resume Next
  Close 1
  Open "Props.txt" For Output As #1
  Dim dbs As Database, cnt As Container
  Dim doc As Document, prp As DAO.Property
  Set dbs = CurrentDb

  Print #1, "Dbs Properties"
  For Each prp In dbs.Properties
    Print #1, "Prop:", prp.Name, prp.Value, prp.Type
  Next prp
  Print #1, ""

  Print #1, "Dbs Containers"
  For Each cnt In dbs.Containers ' daps, tables, forms, modules, etc
    Print #1, "Container:", cnt.Name, cnt.UserName
    For Each prp In cnt.Properties
      Debug.Print "Prop:", prp.Name, prp.Value, prp.Type
    Next prp
    Print #1, ""

    Print #1, "Container Documents"
    For Each doc In cnt.Documents
      Print #1, "Document:", doc.Name
      For Each prp In doc.Properties
        Print #1, "Prop:", prp.Name, prp.Value, prp.Type
      Next prp
    Next doc

  Next cnt

  Close 1
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

-- 
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