[AccessD] Ambiguous Name

jwcolby jwcolby at colbyconsulting.com
Tue Sep 20 11:57:55 CDT 2011


True, scope includes different levels of global.

John W. Colby
www.ColbyConsulting.com

On 9/20/2011 12:41 PM, Jim Dettman wrote:
> Steve,
>
>    I should have said that this code exists in a standard module. objcurDB
> has been declared private to limit the scope to the module, but it's still a
> global variable, which could be accessed by any procedure in that module.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Goodhall
> Sent: Tuesday, September 20, 2011 12:30 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Ambiguous Name
>
> I don't see global in this example.
>
> Sent from my Verizon Wireless Phone
>
> -----Original message-----
> From: Jim Dettman<jimdettman at verizon.net>
> To: 'Access Developers discussion and problem solving'
> <accessd at databaseadvisors.com>
> Sent: Tue, Sep 20, 2011 16:25:09 GMT+00:00
> Subject: Re: [AccessD] Ambiguous Name
>
> There is nothing wrong with using a global variable like this:
>
> Private objcurDB As DAO.Database
>
> Public Function CurDb(Optional bolRefresh As Boolean = False) As
> DAO.Database
>
>   If objcurDB Is Nothing Or bolRefresh = True Then
>      Set objcurDB = CurrentDb()
>   End If
>
>   Set CurDb = objcurDB
>
> End Function
>
>
>   And even if you did define it public, so what?  It's not like it would be
> hard to spot where it's used.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Goodhall
> Sent: Tuesday, September 20, 2011 12:17 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Ambiguous Name
>
> I can't agree.  Global variables break the whole model of structured
> programming.  In many ways they are worse than goto statements.
>
> Sent from my Verizon Wireless Phone
>
> -----Original message-----
> From: Gustav Brock<Gustav at cactus.dk>
> To: accessd at databaseadvisors.com
> Sent: Tue, Sep 20, 2011 14:51:24 GMT+00:00
> Subject: Re: [AccessD] Ambiguous Name
>
> Hi Steve
>
> Nothing wrong with global variables.
> Trouble is always located at those handling these (the programmer!).
>
> /gustav
>
>
>>>> steve at goodhall.info 20-09-2011 01:33:24>>>
> Yet another reason to never use global variables.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Ralf Lister
> Sent: Monday, September 19, 2011 5:19 PM
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Ambiguous Name
>
> Hello all,
>
> I work with Access 2007.
>
> Lately I ran into a problem I don't know how to solve: By running the code I
> got an error message "Ambiguous Name was detected: gsngAportesSR" ("Se ha
> detectado un nombre ambiguo: gsngAportesSR"). I searched the whole code
> looking for gsngAportes defined by two different data types (e.g. Public
> gsngAportesSR As Single, and then also Public gsngAportesSR As Integer), but
> without success.
>
> Does anyone of you know how to fix this problem?
>
> I should say that gsngAportesSR is a global variable with data type Single.
>
> Thanks and Saludos
> Ralf Lister
> La Paz, Bolivia
>
>



More information about the AccessD mailing list