Get Windows Version from MS Access 2007 (1 Viewer)

jaydwest

JayW
Local time
Today, 10:20
Joined
Apr 22, 2003
Messages
340
I would like to get the Version of Windows using MS Access 2007 VBA. I have looked at earlier posts to accomplish this but I was hoping beyond hope that in MSA 2007, MS added this capability.

Has MS added this capability in MSA2007?

Thanks for your help.
 

vbaInet

AWF VIP
Local time
Today, 17:20
Joined
Jan 22, 2010
Messages
26,374
What you need is:
Code:
Application.Version
Although there are some debates as to the validity of the return value.
 

jaydwest

JayW
Local time
Today, 10:20
Joined
Apr 22, 2003
Messages
340
THis appears to be returning the version of MS Access, not the version of Windows.
 

vbaInet

AWF VIP
Local time
Today, 17:20
Joined
Jan 22, 2010
Messages
26,374
Oh, misinterpreted your need.

Environ("os")

I think
 

jaydwest

JayW
Local time
Today, 10:20
Joined
Apr 22, 2003
Messages
340
There appears to be a problem with the environ function. I'm using windows 7, but the function returns windows_nt.

This problem was reported earlier in other posts.
 

vbaInet

AWF VIP
Local time
Today, 17:20
Joined
Jan 22, 2010
Messages
26,374
After much searching, here you go:

Code:
Public Function GetOSName()
On Error GoTo Err_Handler

    Dim objWMIservice As Object, colItems As Object, objItem As Object
    Dim strOSName As String, strWQL As String

    strWQL = "SELECT * FROM Win32_OperatingSystem"
    strComputer = "."
    
    Set objWMIservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIservice.ExecQuery(strWQL, , 48)

    For Each objItem In colItems
        strOSName = objItem.Name
    Next
    
    GetOSName = strOSName

    Set objItem = Nothing
    Set colItems = Nothing
    Set objWMIservice = Nothing

Exit_Err_Handler:
    Exit Function

Err_Handler:
    MsgBox "Error getting OS name" & vbCrLf & "Error: " & Err.Description

End Function

Not as straightforward as you would have imagined:)

Why do you need this information if I may ask? Maybe there's a workaround we could advise.
 

Mike375

Registered User.
Local time
Tomorrow, 02:20
Joined
Aug 28, 2008
Messages
2,548
A crude way:)

A batch file run from Shell

@echo off
VER>Version.doc

TYPE Version.doc

CLIP< version.doc

Copies it as below and VBA can select a text box and copy

Microsoft Windows [Version 6.1.7600]

A link to what the numbers are. The one avove is off my Windows 7

http://www.windows7hacker.com/index.php/2009/08/a-list-of-windows-operating-system-version-number/
 

reginold15

New member
Local time
Today, 09:20
Joined
Feb 18, 2010
Messages
2
I have a table Project. It has the following column:
Project ID, projectName, UpdateTime

The data in the table is as follows:
1, abc, 12-2-2009 01:10:00
1, abc, 12-2-2009 04:18:00
2, xyz, 17-7-2009 08:45:00
2, xyz, 17-7-2009 12:21:00

i want the result set to display the latest update project information based on the update time.
for the above example , it should display
2, xyz, 17-7-2009 12:21:00
1, abc, 12-2-2009 04:18:00

any help appreciated
 

vbaInet

AWF VIP
Local time
Today, 17:20
Joined
Jan 22, 2010
Messages
26,374
I have a table Project. It has the following column:
Project ID, projectName, UpdateTime

The data in the table is as follows:
1, abc, 12-2-2009 01:10:00
1, abc, 12-2-2009 04:18:00
2, xyz, 17-7-2009 08:45:00
2, xyz, 17-7-2009 12:21:00

i want the result set to display the latest update project information based on the update time.
for the above example , it should display
2, xyz, 17-7-2009 12:21:00
1, abc, 12-2-2009 04:18:00

any help appreciated
Please create a new thread.
 

Zigzag

Registered User.
Local time
Today, 17:20
Joined
Aug 19, 2007
Messages
386
Another crude way!

Dim myWS As Object
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")

'read key from registry, Who Windows is registered to?
RegisteredTo = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization")

'read key from registry, what version of Windows?
OpSystem = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
 

ghudson

Registered User.
Local time
Today, 12:20
Joined
Jun 8, 2002
Messages
6,195
Another crude way!

Code:
Dim myWS As Object
'access Windows scripting
Set myWS = CreateObject("WScript.Shell")

'read key from registry, Who Windows is registered to?
RegisteredTo = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsof t\Windows NT\CurrentVersion\RegisteredOrganization")

'read key from registry, what version of Windows?
OpSystem = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsof t\Windows NT\CurrentVersion\ProductName")
Does that work with Windows 7?

I know this topic was discussed within the past few weeks and I thought a solution was posted that would also detect Windows 7.

This also works... http://www.mvps.org/access/api/api0055.htm
 

jaydwest

JayW
Local time
Today, 10:20
Joined
Apr 22, 2003
Messages
340
THanks for all the help.

I wound up testing and using vbaInet Post#6. It returns the data I needed, although I needed to add an instr to return just the version.
 

Zigzag

Registered User.
Local time
Today, 17:20
Joined
Aug 19, 2007
Messages
386
Does that work with Windows 7?

Just tested it with a version of win 7 and this is what was returned.

'Windows 7 Ultimate'
 

Users who are viewing this thread

Top Bottom