Charlotte Foust
charlotte.foust at gmail.com
Wed May 21 07:48:43 CDT 2014
Unless they've changed something while I wasn't looking, some properties have to be "created" before they can be set. They exist in potential and it's a bit like creating an instance of a class in order to use the methods and properties of that class. You can't just address them without the first step. Charlotte On Tue, May 20, 2014 at 10:14 PM, Bill Benson <bensonforums at gmail.com>wrote: > Should one have this instead? > > ' Attempt to set the specified property. > On Error GoTo Err_Property > dbsTemp.Properties(strName) = varSetting > Set dbsTemp.Properties(strName) = varSetting > On Error GoTo 0 > > I doubt with error handling like this, that it could hurt... > > Or are the properties *never* required to be "SET"? > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert > Sent: Tuesday, May 20, 2014 12:31 PM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] AppTitle Property > > "SetPropterty" - It's a UDF. Here is the code... > > Private Sub SetProperty(dbsTemp As Database, strName As String, conType As > DataTypeEnum, varSetting As Variant) ' Parameters: > ' dbsTemp - an initialized Database Object > ' strName - the name of the property > ' conType - the type of the property, e.g. dbBoolean, dbText etc. > ' varSetting - the value to set the property to > > Dim prpNew As Property > Dim errLoop As Error > > ' Attempt to set the specified property. > On Error GoTo Err_Property > dbsTemp.Properties(strName) = varSetting > On Error GoTo 0 > > Exit Sub > > Err_Property: > > ' Error 3270 means that the property was not found. > If DBEngine.Errors(0).Number = 3270 Then > ' Create property, set its value, and append it to the > ' Properties collection. > Set prpNew = dbsTemp.CreateProperty(strName, _ > conType, varSetting) > dbsTemp.Properties.Append prpNew > Resume Next > Else > ' If different error has occurred, display message. > For Each errLoop In DBEngine.Errors > MsgBox "Error number: " & errLoop.Number & vbCr & _ > errLoop.Description > Next errLoop > End > End If > > End Sub > > Lambert > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin > Sent: Tuesday, May 20, 2014 8:51 AM > To: 'Access Developers discussion and problem solving' > Subject: Re: [AccessD] AppTitle Property > > Stuart: > > What is SetProperties? Does not compile. And what should value of > varPropValue be for "AppTitle" > > TIA > > Rocky > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart > McLachlan > Sent: Monday, May 19, 2014 4:14 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] AppTitle Property > > Generally, database properties in Access do not exist until they are set > for > the first time. > > Set it either with the Options - Current Database (or whatever it was in > 2003 > > or in VBA with something like: > > Dim db As DAO.Database, prp As DAO.Property > Set db = CurrentDb > db.Properties(strPropName) = varPropValue > SetProperties = True > Set db = Nothing > > -- > Stuart > > On 19 May 2014 at 16:01, Rocky Smolin wrote: > > > Dear List: > > > > I had a 2003 mdb with a problem - not important what it was - had to > > do with odd mouse behavior in design view. > > > > Anyway, I imported all the objects into a blank mdb and everything > > works better except: > > > > lblVersion.Caption = "Version " & > > Right(CurrentDb.Properties("AppTitle"), _ > > Len(CurrentDb.Properties("AppTitle")) - 46) > > > > works perfectly in the previous version and all versions of this app > > going back to day 1. > > > > In this new one it throws the error 3270 - Property Not Found. > > > > Checked the references - identical between the two mdbs. > > > > Any idea what to look for next? > > > > MTIA > > > > Rocky > > > > -- > > 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 > > -- > 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 >