Get Windows Version from MS Access 2007

jaydwest

JayW
Local time
Today, 00:17
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.
 
What you need is:
Code:
Application.Version
Although there are some debates as to the validity of the return value.
 
THis appears to be returning the version of MS Access, not the version of Windows.
 
Oh, misinterpreted your need.

Environ("os")

I think
 
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.
 
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.
 
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/
 
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
 
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.
 
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")
 
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
 
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.
 
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

Back
Top Bottom