[thelist] Crystal Reports Question [SOLVED]

John.Brooking at sappi.com John.Brooking at sappi.com
Thu Sep 9 09:32:08 CDT 2004

>Date: Wed, 8 Sep 2004 07:50:23 -0700 (PDT)
>From: Scott Dexter <dexilalolai at yahoo.com>
>well, I think I got it.
> <snip/>
>    ' where are we looking?
>    If InStr(UCase(fullPathName), "DEV") > 0 Then
>      crystalConnectionProperties.Add "Initial Catalog", "DEVDB"
>    ElseIf InStr(UCase(fullPathName), "TEST") > 0 Then
>      crystalConnectionProperties.Add "Initial Catalog", "TESTDB"
>    Else
>      crystalConnectionProperties.Add "Initial Catalog", "PRODDB"
>    End If

Well, now that you and others have done the hard part of solving the
problem, I'll chime in with a minor suggestion about the solution. :-) I
don't see from your code where "fullPathName" is set, but I assume it's some
kind of file system path, so you're assuming that the path will contain the
phrase "DEV" or "TEST" unless it's production. Instead of making this
assumption, I would define the database name as a variable or maybe even
function return value in a separate module by itself (maybe with some other
region-dependent assignments, if you have any more), so you can put a
different version of that module in each region, isolating it from the rest
of your code, and just pull in that module. This will always define the
right values for the place it's in, without cluttering up your main code. I
don't know exactly how including a module is done in your coding
environment, but I'm assuming it can be. (If I'm wrong, ignore me!)

- John

This message may contain information which is private, privileged or
confidential and is intended solely for the use of the individual or entity
named in the message. If you are not the intended recipient of this message,
please notify the sender thereof and destroy / delete the message. Neither
the sender nor Sappi Limited (including its subsidiaries and associated
companies) shall incur any liability resulting directly or indirectly from
accessing any of the attached files which may contain a virus or the like. 

More information about the thelist mailing list