I want to add fields to my software table if the field doesn't exist already. But I don't find how I can do this action. Could someone please help me? This is my script:

Code:
 

$Connection = CreateObject("ADODB.Connection")
$Connection.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\inventory\inventory.mdb"
$Connection.Open()
if not @error
$Command = CreateObject("ADODB.Command")
$Command.ActiveConnection = $Connection
$Recordset = CreateObject("ADODB.Recordset")
$Recordset.CursorType = 3
$Recordset.LockType = 3
$Recordset.ActiveCommand = $Command

$Command.CommandText = "SELECT * FROM [tbl_Software] WHERE SerialNumber='$SerNo'"
$Recordset.Open($Command)
$Recordset.Fields("SerialNumber").Value = $SerNo
$Recordset.Update
$Recordset.Close()

$Connection.Close()
$Connection = 0
$Recordset = 0
$Command = 0
endif



Edited by Steven (2004-11-22 01:50 PM)