Solved

using the registrykey command (as opposed to the getallsettings command)

Posted on 2003-11-16
4
548 Views
Last Modified: 2012-06-27
as most people know (and i just found out), the getallsettings command in access VB is limited to the vb settings folder of the hkey_current_user portion of the registry.

here's the code i *was* using:

---
    Dim MySettings As Variant, intSettings As Integer, copyprotect As String

    ' Check registry settings
    MySettings = GetAllSettings(appname:="MyProgram", section:="Startup")
    For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
        If intSettings = 0 Then
            If MySettings(intSettings, 0) = "Right" And MySettings(intSettings, 1) = "5" Then
                copyprotect1 = "okay"
            End If
        ElseIf intSettings = 1 Then
            If MySettings(intSettings, 0) = "Bottom" And MySettings(intSettings, 1) = "7" Then
                copyprotect2 = "okay"
            End If
        End If
    Next intSettings
---

my problem is that i need to be able to read settings from the hkey_local_machine portion of the registry.  after reading about the .net framework on the msdn site, i'm confused regarding the proper use of the registrykey command.

can anyone help me do what i was doing before now that i'm playing with what seems to be a totally different command?

(i'm using access 2000, if that makes any difference.)

thanx!
danielle
www.brownflower.com/danielletx
0
Comment
Question by:danielletx
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 9762104
There are some examples of reading registry entries here
http://www.mvps.org/access/api/api0015.htm

Pete
0
 
LVL 4

Expert Comment

by:inox
ID: 9762992

you can use

    Dim objWSH As Object    
    Set objWSH = CreateObject("WScript.Shell")

e.g.    objWSH.RegWrite "HKLM\Software\MyApplication\strValue",
"Some string value"

objWSH.RegWrite "HKLM\Software\MyApplication\key1", 1234, "REG_DWORD"

0
 

Author Comment

by:danielletx
ID: 9773491
i REALLY like the elegance and brevity of inox's comment.  the only problem is that the objWSH.RegWrite command actually *writes* a value to the registry rather than reading it.

i tried to use objWSH.RegRead, and i get an error.

is there some way to use the whol objWSH thing that will look for the path that i specified in my question...?

sorry.  i'm a little dense when it comes to VB, and so i have a hard time making even tiny little logical leaps.

thanx so much for all the help everyone has offered!  :)
danielle
http://www.brownflower.com/danielletx
0
 
LVL 4

Accepted Solution

by:
inox earned 125 total points
ID: 9776976

danielle,
of course the objWSH ("WScript.Shell") can read values from registry, can you post your commands
or verify to be like

  Dim objWSH As Object
  Set objWSH = CreateObject("WScript.Shell")
  objWSH.RegWrite "HKCU\Software\VB and VBA Program Settings\App1\Sect1\DW1", 123, "REG_DWORD"
  L = objWSH.RegRead("HKCU\Software\VB and VBA Program Settings\App1\Sect1\DW1")
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question