[AccessD] Error help with upgrade from A03 to A13

Jim Dettman jimdettman at verizon.net
Thu Nov 24 05:50:56 CST 2016


 
<<But here's a question for you: do you still think its wiser to use custom
database properties rather than global variables?>>

 Depends on what your using it for I think.  Also keep in mind that later
version have tempvars, which fall in the middle. They are a variable like a
global, but they don't loose their value on a VBA reset.

I would use a database property for something like an app title, or version
number possibly.   Tempvars to load at startup for things like app flags,
and globals for very temp/scratch work.  But, you can use any one of the
three for any of the others if you really want to.

Personally, I've always stuck with globals for everything, but I don't use
them all that much.   That's mainly because it's how I started, and I have
logic in place to work that way.

Jim.


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
John R Bartow
Sent: Wednesday, November 23, 2016 03:32 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Error help with upgrade from A03 to A13
Importance: High

Jim, Stuart, John:
Thanks for your assistance! It's been a LONG time since I've even looked at
VBA code and what was happening in this case is that I was working with an
app file that was not the correct one. It was a "next version" I had been
working on but never went too far with. I had been switching some code that
had used global variables into using custom properties instead. I worked on
finishing that in A2003 in a VM. I then brought it into A2013. On first
attempt at compile it barked about procedures with CurrentDB() - had to
remove the parenthesis. Oddly it did not bark about them all. It barked
about the one in the last Class Object I had edited in A2003. There are
others in there that it didn't see as a problem but I replaced them anyway. 

So I finished doing that and it all works now. 

But here's a question for you: do you still think its wiser to use custom
database properties rather than global variables?

PS: must be throwback month. I had to resuce a sign shop that was using a
Windows 3.1 PC (nothing has changed on it since 1992.) as a cutting machine
controller. Guess they don't run forever. VM is now their friend until they
get new a new cutting machine.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim
Dettman
Sent: Wednesday, November 16, 2016 6:59 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Error help with upgrade from A03 to A13

Also this, which might make the app a bit more bullet proof depending on
what your using those properties for.

Jim.

Private Sub Form_Open(Cancel As Integer)
	Dim strTitle As String, strSubject As String, strAuthor As String

	strTitle = "Title"
	strSubject = "Subject"
	strAuthor = "Author"

	Me!txtTitle = GetSummaryInfo(strTitle)
	Me!txtSubject = GetSummaryInfo(strSubject)
	Me!txtAuthor = GetSummaryInfo(strAuthor) End Sub

Function GetSummaryInfo(strPropName As String) As String
	Dim dbs As Database, cnt As Container
	Dim doc As Document, prp As Property

	' Property not found error.

Const conPropertyNotFound = 3270
	On Error GoTo GetSummary_Err
	Set dbs = CurrentDb
	Set cnt = dbs.Containers!Databases
	Set doc = cnt.Documents!SummaryInfo
	doc.Properties.Refresh
	GetSummaryInfo = doc.Properties(strPropName)

GetSummary_Bye:
	Exit Function

GetSummary_Err:
	If Err = conPropertyNotFound Then
		Set prp = doc.CreateProperty(strPropName, dbText, "None")
		' Append to collection.
		doc.Properties.Append prp
		Resume
	Else

' Unknown error.
		GetSummaryInfo = ""
		Resume GetSummary_Bye
	End If
End Function 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
John R Bartow
Sent: Wednesday, November 16, 2016 02:45 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Error help with upgrade from A03 to A13
Importance: High

Yes, thanks, I cannot find where its created. I'm going to have to go back
into the old version to figure this out. VM time.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Stuart McLachlan
Sent: Wednesday, November 16, 2016 1:18 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Error help with upgrade from A03 to A13

To create a custom property you need to do something like:

Set dbs = CurrentDb
Set prp = dbs.CreateProperty("CheckForLabelPrinter", dbBoolean, True)
dbs.Properties.Append prp


On 16 Nov 2016 at 1:10, John R Bartow wrote:

> That is creating a custom property so it exists as soon as it's made.
> But to further that idea, maybe the method of creating a custom 
> property has changed (or needs to be more implicit in newer versions?)
> 
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf 
> Of Stuart McLachlan Sent: Wednesday, November 16, 2016 12:30 AM To:
> Access Developers discussion and problem solving Subject: Re:
> [AccessD] Error help with upgrade from A03 to A13
> 
> Since you've converted the DB, are you sure the property still exists?
>  
> 
> 
> 
> On 15 Nov 2016 at 23:48, John R Bartow wrote:
> 
> > Good WAG but that didn't do that trick.
> > 
> > -----Original Message-----
> > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On 
> > Behalf Of Stuart McLachlan Sent: Tuesday, November 15, 2016 7:51 PM
> > To: Access Developers discussion and problem solving Subject: Re:
> > [AccessD] Error help with upgrade from A03 to A13
> > 
> > Just a WAG.  Try Dim dbs As DAO.Database.
> > 
> > Without the DAO, you can get strange error messages when trying to 
> > access properties.
> > 
> > 
> > 
> > On 15 Nov 2016 at 19:29, John R Bartow wrote:
> > 
> > > Dim dbs As Database
> > 
> > 
> > --

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



More information about the AccessD mailing list