basically it is your code almost verbatim... with the DB name changed to protect the innocent. I figured once I make it work then I can customize it.

code:

Break On

;Retrieve info by calls to WMIQuery() function
$SystemManufacturer = WMIQuery("Manufacturer","Win32_ComputerSystem")
$SystemModel = WMIQuery("Model","Win32_ComputerSystem")
$SerialNo = WMIQuery("SerialNumber","Win32_BIOS")
$PhysicalMemory = val(WMIQuery("TotalPhysicalMemory","Win32_LogicalMemoryConfiguration"))/1024
$ProcessorSpeed = WMIQuery("CurrentClockSpeed","Win32_Processor") + " Mhz"
$PagefileSpace = val(WMIQuery("TotalPageFileSpace","Win32_LogicalMemoryConfiguration"))/1024
;Enumerate all disk info into arrays, then cross-reference for required info
$arrDeviceIDs = Split(WMIQuery("DeviceID","Win32_LogicalDisk"),"|",-1)
$arrFreeSpaces = Split(WMIQuery("FreeSpace","Win32_LogicalDisk"),"|",-1)
$arrTotalSizes = Split(WMIQuery("Size","Win32_LogicalDisk"),"|",-1)
$arrFormats = Split(WMIQuery("FileSystem","Win32_LogicalDisk"),"|",-1)
For $Counter = 0 To UBound($arrDeviceIDs)
If $arrDeviceIDs[$Counter] = "C:"
$C_DriveFormat = $arrFormats[$Counter]
$C_DriveFreeSpace = $arrFreeSpaces[$Counter]
$C_DriveTotalSize = $arrTotalSizes[$Counter]
$Counter = UBound($arrDeviceIDs) + 1
Endif
Next
;Sort the returned disk spaces values into MB
;$C_DriveFreeSpace = Val($C_DriveFreeSpace)/1048576
;$C_DriveTotalSize = Val($C_DriveTotalSize)/1048576
;First, set variables for the connection to the database and other general options
$=SetOption("WrapAtEOL","On")
$DATABASE = "$logon\inventory\inventory.mdb"
$DSN="Driver={Microsoft Access Driver (*.mdb)}; DBQ=$DATABASE"
;Create SQL statements to check/write/update database
$CHECK_ENTRY_USERS = "SELECT * FROM TBL_USERS WHERE USERNAME='@USERID';"
$CHECK_ENTRY_COMPUTERS = "SELECT * FROM TBL_COMPUTERS WHERE WORKSTATION='@WKSTA';"
$Connection = CreateObject("ADODB.Connection")
$Command = CreateObject("ADODB.Command")
$Recordset = CreateObject("ADODB.Recordset")
;Check for connection object
if $Connection
? "i'm in there"
;Open connection to database
$Connection.ConnectionString = $DSN
$Connection.Open()
;Check for existing records for the current workstation/user
;Add new record or update existing as required
;Check for User details first
$Command.ActiveConnection = $Connection
$Recordset.CursorType = 3
$Recordset.LockType = 3
$Recordset.ActiveCommand = $Command
$Command.CommandText = $CHECK_ENTRY_USERS
$Recordset.Open($Command)
;Create new record if none exists to update
If $Recordset.RecordCount < 1
? "adding new user record"
$Recordset.AddNew
Endif
;Write user values into database field by field
$Recordset.Fields("UserName").Value = @USERID
$Recordset.Fields("FullName").Value = @FULLNAME
$Recordset.Fields("Workstation").Value = @WKSTA
$Recordset.Fields("PrivilegeLevel").Value = @PRIV
$Recordset.Fields("HomeDrive").Value = @HOMESHR
$Recordset.Fields("LastUpdate").Value = @DATE + " " + @TIME
;Update the new record and close the recordset object
$Recordset.Update
$Recordset.Close()
;Check Computer details next - refresh $Recordset object with new query
$Command.CommandText = $CHECK_ENTRY_COMPUTERS
$Recordset.Open($Command)
;Check for existing record to update
If $Recordset.RecordCount < 1
? "adding new computer record"
$Recordset.AddNew
Endif
;Write values into table
$Recordset.Fields("Workstation").Value = @WKSTA
$Recordset.Fields("NTDomain").Value = @DOMAIN
$Recordset.Fields("SystemManufacturer").Value = $SystemManufacturer
$Recordset.Fields("SystemModel").Value = $SystemModel
$Recordset.Fields("SerialNo").Value = $SerialNo
$Recordset.Fields("IPAddress").Value = @IPADDRESS0
$Recordset.Fields("MACAddress").Value = @ADDRESS
$Recordset.Fields("OS").Value = @PRODUCTTYPE
$Recordset.Fields("ServicePack").Value = @CSD
$Recordset.Fields("PhysicalMemory").Value = $PhysicalMemory
$Recordset.Fields("ProcessorSpeed").Value = $ProcessorSpeed
$Recordset.Fields("PagefileSpace").Value = $PagefileSpace
$Recordset.Fields("C_DriveFormat").Value = $C_DriveFormat
$Recordset.Fields("C_DriveFreeSpace").Value = $C_DriveFreeSpace
$Recordset.Fields("C_DriveTotalSize").Value = $C_DriveTotalSize
$Recordset.Fields("LoggedOnUser").Value = @USERID
$Recordset.Fields("LastUpdate").Value = @DATE + " " + @TIME
;Update and close recordset object
$Recordset.Update
$Recordset.Close()
$Connection.Close()
$Connection = 0
$Recordset = 0
$Command = 0
else
Goto error
endif
:end

exit 321
:error
exit\


_________________________
How to ask questions the smart way <-----------> Before you ask