2

I'm creating a form in Access that processes millions of lines of data, and takes several hours (depending on your computer). I want to implement a feature that will read the computer specs, such as CPU speed and amount of RAM, and determine how long the process will take.

Is it possible to get the computer specs using VBA?

Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
Shubham
  • 949
  • 6
  • 21
  • 29
  • 3
    You will not be able to determine how long it will take anyway, it depends a lot more on what other processes are running on the system. – vichle Jul 29 '11 at 06:20

2 Answers2

4

1) There is this "environ" function that can give you informations on the "computer" environment. It is usually used to get things such as user name or temp folder, but it is said to return the following values:

environ(x): value returned
1 : ALLUSERSPROFILE
2 : APPDATA
3 : CLIENTNAME
4 : CommonProgramFiles
5 : COMPUTERNAME
6 : ComSpec
7 : HOMEDRIVE
8 : HOMEPATH
9 : LOGONSERVER
10 : NUMBER_OF_PROCESSORS
11 : OS
12 : Path
13 : PATHEXT
14 : PROCESSOR_ARCHITECTURE
15 : PROCESSOR_IDENTIFIER
16 : PROCESSOR_LEVEL
17 : PROCESSOR_REVISION
18 : ProgramFiles
19 : SESSIONNAME
20 : SystemDrive
21 : SystemRoot
22 : TEMP
23 : TMP
24 : USERDOMAIN
25 : USERNAME
26 : USERPROFILE
27 : windir 

2) you have some shell functions that can be used to launch external programs and get a value back. In addition to the standard VBA shell function, you also have some interesting things such as this "shell and wait" function.

3) Of course, you can always declare functions from the windows API in your VBA code and use them to get needed values ...

Community
  • 1
  • 1
Philippe Grondier
  • 10,900
  • 3
  • 33
  • 72
  • My idea was here to propose different tracks or ideas rather than a "real/direct" answer, aut most people are usually happy when given hints that can put them on the right track(s) ... – Philippe Grondier Aug 03 '11 at 10:12
4

You should be able to retrieve System Information by calling WMI Service Object.

WMI Tasks: Computer Hardware

WMI Accounts and Computer Information

Using the Power of VBScripts and WMI in Microsoft Access VBA

Michalis
  • 1,508
  • 1
  • 10
  • 10
  • 2
    Very nice links, but you might want to consider adding some of the salient points from the articles. This is helpful in combating link rot. – Conrad Frix Jul 29 '11 at 16:01