[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

Obtaining a value in MS Access 2003 from the registry

Hi experts,

I have a value in a registry that is being created by a security program.  I wish to use this value within my MS Access 2003 application.  I intend it to use an unbound field and place the value in that field. I do not know how to do that and have tried to use GetSettings unsuccessfully.  

The value I am trying to reach is in my registry at :
HKEY_LOCAL_MACHINE > SOFTWARE > COMPANYNAME > APPLICATIONNAME > INSTALL DATE

I will be grateful for any help.

Regards,
Terry
0
TerenceHewett
Asked:
TerenceHewett
1 Solution
 
EDDYKTCommented:
Public Function ReadRegKey(ByVal keyval As String) As String
    Dim objWSHShell As Object
   
    On Error Resume Next
    Set objWSHShell = CreateObject("WScript.Shell")
    ReadRegKey = objWSHShell.RegRead(keyval)
    If (ReadRegKey = keyval) Then ReadRegKey = ""
    Set objWSHShell = Nothing
End Function

to call
debug.print ReadRegKey("HKLM\Software\COMPANYNAME\APPLICATIONNAME\INSTALL  DATE")
0
 
TerenceHewettAuthor Commented:
Thank you to both for your posts.  EDDYKT, your code worked exactly as I wanted - thank you so much.

Best regards,
Terry




0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now