Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 3rd, 2005, 10:23 AM
Registered User
 
Join Date: Oct 2005
Location: Bucharest, , Romania.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading hardware parameters from VBA code

Hello.
Does anybody know how can I read the HDD series or some other hardware parameters from within VBA code in MS Access?
If you can help me, thanks a lot.

Reply With Quote
  #2 (permalink)  
Old October 4th, 2005, 01:44 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yes, you need to use a WMI query. Here is a basic format I use to gather data about the local hard drive:

Dim strDrive As String
Dim strComputer As String

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive",,48)
For Each objItem in colItems
    intDiskSpace = Int(objItem.Size / 1000000)
Next

strDrive = "C"
Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & strDrive &":'")
intFreeSpace = int(objLogicalDisk.FreeSpace / 1000000)
intRem = (intFreeSpace / intDiskSpace)
'STORE THESE HARD DRIVE VALUES
objRecordset("DiskDriveSize") = intDiskSpace
objRecordset("SpaceRemaining") = intFreeSpace
objRecordset("PerCentRemaining") = FormatPercent(intRem, 2)

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old October 5th, 2005, 01:47 AM
Registered User
 
Join Date: Oct 2005
Location: Bucharest, , Romania.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:) Thank's!

Reply With Quote
  #4 (permalink)  
Old October 5th, 2005, 07:55 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is there a way of checking the screen setting of the Clients PC so that you could make the nessassary provisions for Form sizes etc.
Better still - Would it be possible to set the screen settings to 800X600 in VB?

Thanx
Base
Reply With Quote
  #5 (permalink)  
Old October 5th, 2005, 08:13 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Yes there is. I will look it up.
You don't ever want to change the screen settings of a user, especially to something ugly like 800x600.
Anyway, if you are designing for 800x600, it will show up well enough on anyone's machine since that is the smallest resolution these days.

mmcdonal
Reply With Quote
  #6 (permalink)  
Old October 6th, 2005, 02:24 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks - I'll await your reply. My Work PC is set to 1024 X 768 but I battle to see if I set my Home PC or Laptop to the same. So when I move my appication around I notice the diffence and though that it might create problems later with diff Clients. It would be nice to be able to read and write - then I could change the settings on opening and restore on closing. Else I'll stick to your adivce about the 800X600 "standard".

Thanx so far
Base
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
run query via vba with parameters The_Vicar VBScript 0 April 21st, 2008 06:38 AM
Parameters from SQL to VBA Skan Access VBA 4 October 25th, 2007 06:53 AM
Reading in webpages in standard Excel VBA w_g_day Excel VBA 5 May 24th, 2005 12:44 PM
reading parameters skaya Crystal Reports 0 August 10th, 2004 09:20 AM
Excel2002: Passing parameters from IE to VBA HappyAlex Excel VBA 0 April 6th, 2004 11:26 AM



All times are GMT -4. The time now is 05:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.