The Amazing Disappearing Registry Key

The Amazing Disappearing Registry Key

Post by James Brow » Sat, 02 Mar 2002 19:46:17



Hi,

I've been using the SaveSetting command in Access VBA to store a simple
string of either "1" or "2" depending on the mode of the application.  If
the value is "0" it means it has never been assigned, and therefore the
application has never been installed.  Nowhere in my application is the
value ever assigned to zero.  However, every now and again (say 1 in 4
times) when I start the database it returns "0" and the database starts as
if it had never been installed.

Is there some glitch I should know about?  I'm using Access2000 Developer.

--
Regards,

Jamie Brown, Software Developer
InfoComp Ltd

URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by Terry Kref » Sat, 02 Mar 2002 20:57:10


A look at some sample code would be nice.

Here's a guess though,
 You're using GetSetting to get teh value, you're then using Val to cast the
string to a number.

If this is correct then if getsetting returns "", which it will do if your
registry setting is missing, then Val will convert this to 0

--
Terry Kreft
Access MVP

***********************************************
If it's not plain text, without attachments,
I'm not reading it.
***********************************************


> Hi,

> I've been using the SaveSetting command in Access VBA to store a simple
> string of either "1" or "2" depending on the mode of the application.  If
> the value is "0" it means it has never been assigned, and therefore the
> application has never been installed.  Nowhere in my application is the
> value ever assigned to zero.  However, every now and again (say 1 in 4
> times) when I start the database it returns "0" and the database starts as
> if it had never been installed.

> Is there some glitch I should know about?  I'm using Access2000 Developer.

> --
> Regards,

> Jamie Brown, Software Developer
> InfoComp Ltd

> URL: http://www.infocomp.co.uk


 
 
 

The Amazing Disappearing Registry Key

Post by James Brow » Sat, 02 Mar 2002 23:40:31


Hi,

Here is the code:

********************* BEGINS ***********************

    intLinked = CInt(GetSetting("STMCFE " + strClient, "StockApp", "Linked",
"0"))

    If intLinked <> 1 Then

        if intLinked=0 then
            msgbox "First time application has been loaded"
        else
            msgbox "Relinking, as requested by user"
        end if

        ... relinking code ...

        SaveSetting "STMCFE " + strClient, "StockApp", "Linked", "1"

    End If

********************* ENDS ***********************

strClient never changes (it is build up from the Applications path), and the
only other time the value in the registry is changed, it is set to 2, when
the user wants to relink the database.  However, around 1 in 4 times that I
run the database it says "First time the application has been loaded."

--
Regards,

Jamie Brown, Software Developer
InfoComp Ltd

URL: http://www.infocomp.co.uk

> Hi,

> I've been using the SaveSetting command in Access VBA to store a simple
> string of either "1" or "2" depending on the mode of the application.  If
> the value is "0" it means it has never been assigned, and therefore the
> application has never been installed.  Nowhere in my application is the
> value ever assigned to zero.  However, every now and again (say 1 in 4
> times) when I start the database it returns "0" and the database starts as
> if it had never been installed.

> Is there some glitch I should know about?  I'm using Access2000 Developer.

> --
> Regards,

> Jamie Brown, Software Developer
> InfoComp Ltd

> URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by Terry Kref » Sun, 03 Mar 2002 02:09:50


James,
That should be OK, what I would do is break it down though to something like

********************* BEGINS ***********************
    Dim strApp as string
    dim strVal as string
    strApp = "STMCFE "  & strClient

    strVal = GetSetting(strApp, "StockApp", "Linked", "0")
    intLinked = CInt(strval)

' I would do the rest as a Select Case but whatever

********************* ENDS ***********************

As you can see effectively little difference.

If you continue to have problems have a look at how you are getting
strClient.

Check in the registry whenever it goes wrong and just see if it's writing
values to places it shouldn't be.

--
Terry Kreft
Access MVP

***********************************************
If it's not plain text, without attachments,
I'm not reading it.
***********************************************


> Hi,

> Here is the code:

> ********************* BEGINS ***********************

>     intLinked = CInt(GetSetting("STMCFE " + strClient, "StockApp",
"Linked",
> "0"))

>     If intLinked <> 1 Then

>         if intLinked=0 then
>             msgbox "First time application has been loaded"
>         else
>             msgbox "Relinking, as requested by user"
>         end if

>         ... relinking code ...

>         SaveSetting "STMCFE " + strClient, "StockApp", "Linked", "1"

>     End If

> ********************* ENDS ***********************

> strClient never changes (it is build up from the Applications path), and
the
> only other time the value in the registry is changed, it is set to 2, when
> the user wants to relink the database.  However, around 1 in 4 times that
I
> run the database it says "First time the application has been loaded."

> --
> Regards,

> Jamie Brown, Software Developer
> InfoComp Ltd

> URL: http://www.infocomp.co.uk


> > Hi,

> > I've been using the SaveSetting command in Access VBA to store a simple
> > string of either "1" or "2" depending on the mode of the application.
If
> > the value is "0" it means it has never been assigned, and therefore the
> > application has never been installed.  Nowhere in my application is the
> > value ever assigned to zero.  However, every now and again (say 1 in 4
> > times) when I start the database it returns "0" and the database starts
as
> > if it had never been installed.

> > Is there some glitch I should know about?  I'm using Access2000
Developer.

> > --
> > Regards,

> > Jamie Brown, Software Developer
> > InfoComp Ltd

> > URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by david » Tue, 05 Mar 2002 17:56:19


Note that Get and Save Setting use a value from Current User,
so if someone else logs in, they won't know that the database
has already been linked.

(david)


> Hi,

> I've been using the SaveSetting command in Access VBA to store a simple
> string of either "1" or "2" depending on the mode of the application.  If
> the value is "0" it means it has never been assigned, and therefore the
> application has never been installed.  Nowhere in my application is the
> value ever assigned to zero.  However, every now and again (say 1 in 4
> times) when I start the database it returns "0" and the database starts as
> if it had never been installed.

> Is there some glitch I should know about?  I'm using Access2000 Developer.

> --
> Regards,

> Jamie Brown, Software Developer
> InfoComp Ltd

> URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by James Brow » Mon, 04 Mar 2002 23:09:35


Hi,

Thanks for the tip.  I've taken a look in the registry and the value of the
key that has been written is 1, as it should be.  However, it still
sometimes returns 0.  Surely if strClient was wrong then it would write
another value in a new regsitry?  There is only one instance of it, however.

Any other ideas?

--
Regards,

Jamie Brown, Software Developer
InfoComp Ltd

URL: http://www.infocomp.co.uk

> James,
> That should be OK, what I would do is break it down though to something
like

> ********************* BEGINS ***********************
>     Dim strApp as string
>     dim strVal as string
>     strApp = "STMCFE "  & strClient

>     strVal = GetSetting(strApp, "StockApp", "Linked", "0")
>     intLinked = CInt(strval)

> ' I would do the rest as a Select Case but whatever

> ********************* ENDS ***********************

> As you can see effectively little difference.

> If you continue to have problems have a look at how you are getting
> strClient.

> Check in the registry whenever it goes wrong and just see if it's writing
> values to places it shouldn't be.

> --
> Terry Kreft
> Access MVP

> ***********************************************
> If it's not plain text, without attachments,
> I'm not reading it.
> ***********************************************



> > Hi,

> > Here is the code:

> > ********************* BEGINS ***********************

> >     intLinked = CInt(GetSetting("STMCFE " + strClient, "StockApp",
> "Linked",
> > "0"))

> >     If intLinked <> 1 Then

> >         if intLinked=0 then
> >             msgbox "First time application has been loaded"
> >         else
> >             msgbox "Relinking, as requested by user"
> >         end if

> >         ... relinking code ...

> >         SaveSetting "STMCFE " + strClient, "StockApp", "Linked", "1"

> >     End If

> > ********************* ENDS ***********************

> > strClient never changes (it is build up from the Applications path), and
> the
> > only other time the value in the registry is changed, it is set to 2,
when
> > the user wants to relink the database.  However, around 1 in 4 times
that
> I
> > run the database it says "First time the application has been loaded."

> > --
> > Regards,

> > Jamie Brown, Software Developer
> > InfoComp Ltd

> > URL: http://www.infocomp.co.uk


> > > Hi,

> > > I've been using the SaveSetting command in Access VBA to store a
simple
> > > string of either "1" or "2" depending on the mode of the application.
> If
> > > the value is "0" it means it has never been assigned, and therefore
the
> > > application has never been installed.  Nowhere in my application is
the
> > > value ever assigned to zero.  However, every now and again (say 1 in 4
> > > times) when I start the database it returns "0" and the database
starts
> as
> > > if it had never been installed.

> > > Is there some glitch I should know about?  I'm using Access2000
> Developer.

> > > --
> > > Regards,

> > > Jamie Brown, Software Developer
> > > InfoComp Ltd

> > > URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by Terry Kref » Tue, 05 Mar 2002 19:28:21


The bit about writing the value to a different key was what I was looking to
see happen.

If strClient is definitely correct then to be honest I'm at  a loss, I've
never had SaveSetting/GetSetting fail in this way.

Have a look at Davids answer elsewhere in this thread for a possible
solution.

--
Terry Kreft
Access MVP

***********************************************
If it's not plain text, without attachments,
I'm not reading it.
***********************************************


> Hi,

> Thanks for the tip.  I've taken a look in the registry and the value of
the
> key that has been written is 1, as it should be.  However, it still
> sometimes returns 0.  Surely if strClient was wrong then it would write
> another value in a new regsitry?  There is only one instance of it,
however.

> Any other ideas?

> --
> Regards,

> Jamie Brown, Software Developer
> InfoComp Ltd

> URL: http://www.infocomp.co.uk


> > James,
> > That should be OK, what I would do is break it down though to something
> like

> > ********************* BEGINS ***********************
> >     Dim strApp as string
> >     dim strVal as string
> >     strApp = "STMCFE "  & strClient

> >     strVal = GetSetting(strApp, "StockApp", "Linked", "0")
> >     intLinked = CInt(strval)

> > ' I would do the rest as a Select Case but whatever

> > ********************* ENDS ***********************

> > As you can see effectively little difference.

> > If you continue to have problems have a look at how you are getting
> > strClient.

> > Check in the registry whenever it goes wrong and just see if it's
writing
> > values to places it shouldn't be.

> > --
> > Terry Kreft
> > Access MVP

> > ***********************************************
> > If it's not plain text, without attachments,
> > I'm not reading it.
> > ***********************************************



> > > Hi,

> > > Here is the code:

> > > ********************* BEGINS ***********************

> > >     intLinked = CInt(GetSetting("STMCFE " + strClient, "StockApp",
> > "Linked",
> > > "0"))

> > >     If intLinked <> 1 Then

> > >         if intLinked=0 then
> > >             msgbox "First time application has been loaded"
> > >         else
> > >             msgbox "Relinking, as requested by user"
> > >         end if

> > >         ... relinking code ...

> > >         SaveSetting "STMCFE " + strClient, "StockApp", "Linked", "1"

> > >     End If

> > > ********************* ENDS ***********************

> > > strClient never changes (it is build up from the Applications path),
and
> > the
> > > only other time the value in the registry is changed, it is set to 2,
> when
> > > the user wants to relink the database.  However, around 1 in 4 times
> that
> > I
> > > run the database it says "First time the application has been loaded."

> > > --
> > > Regards,

> > > Jamie Brown, Software Developer
> > > InfoComp Ltd

> > > URL: http://www.infocomp.co.uk


> > > > Hi,

> > > > I've been using the SaveSetting command in Access VBA to store a
> simple
> > > > string of either "1" or "2" depending on the mode of the
application.
> > If
> > > > the value is "0" it means it has never been assigned, and therefore
> the
> > > > application has never been installed.  Nowhere in my application is
> the
> > > > value ever assigned to zero.  However, every now and again (say 1 in
4
> > > > times) when I start the database it returns "0" and the database
> starts
> > as
> > > > if it had never been installed.

> > > > Is there some glitch I should know about?  I'm using Access2000
> > Developer.

> > > > --
> > > > Regards,

> > > > Jamie Brown, Software Developer
> > > > InfoComp Ltd

> > > > URL: http://www.infocomp.co.uk

 
 
 

The Amazing Disappearing Registry Key

Post by James Brow » Wed, 06 Mar 2002 20:13:44


Hi,

Thanks - I never thought of that, but thankfully its not too much of an
issue.  Thanks though.

--
Regards,

Jamie Brown, Software Developer
InfoComp Ltd

URL: http://www.infocomp.co.uk


> Note that Get and Save Setting use a value from Current User,
> so if someone else logs in, they won't know that the database
> has already been linked.

> (david)




> > Hi,

> > I've been using the SaveSetting command in Access VBA to store a simple
> > string of either "1" or "2" depending on the mode of the application.
If
> > the value is "0" it means it has never been assigned, and therefore the
> > application has never been installed.  Nowhere in my application is the
> > value ever assigned to zero.  However, every now and again (say 1 in 4
> > times) when I start the database it returns "0" and the database starts
as
> > if it had never been installed.

> > Is there some glitch I should know about?  I'm using Access2000
Developer.

> > --
> > Regards,

> > Jamie Brown, Software Developer
> > InfoComp Ltd

> > URL: http://www.infocomp.co.uk

 
 
 

1. The Amazing Disappearing linux netasst

Totally mystified about this:  RedHat 6.2,  oracle 8.1.5,
hacked through the entire install  so far  and I believe
I am "clean"  on everything.
I have two instances running after two days of work.
!!  ( here is a hint: let dbassist make a script, not a
database).

"netasst"  just does nothing.  It returns a nice 0  for its
error code.
It leaves no processes behind.  No trace of its little
self whatsoever.

Any ideas, fellow oracle-on-linux  trailblazers?

Chris O'Connor

(adventurer)

Sent via Deja.com http://www.deja.com/
Before you buy.

2. SQL*Net on OS/390

3. cursor row disappear after changing a primary key

4. Searching through a binary field

5. variable values disappearing after using ON KEY in INPUT statement

6. Move everything from one server to another server . . .

7. Disappearing key fields in Paradox 3.5...

8. Capturing 'Show Plan Statistics' in a Trace

9. Disappearing Foreign Keys in DB2 V7.1?

10. Disappearing keys!!

11. Key Fileds Periodically Disappear in Paradox 2.0

12. Disappearing key field definitions

13. Disappearing Keys