Hi Boys!! Late isnt it?........bothering with table stuff again. Here i go!
I have three tables Users, Machine and Relations (in fact they are more like software, an another to come) and i cannot join them. I have read the access helt and found and example but cannot make it work. I do make them work individually (Users and Machine) but not Relations with ID_Users and ID_Machine.
Here is the code: code:
CLS
SetOption("WrapAtEOL","On")
$Connectionstring = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=\\server\kixexe$$\database\logon.mdb"
$Connection = CreateObject ("ADODB.Connection")
$Command = CreateObject ("ADODB.Command")
$recordset = CreateObject ("ADODB.RecordSet")
$Connection.connectionstring = $Connectionstring
$Connection.Open
$Command.activeconnection = $Connection
$recordset.curecordsetortype = 3
$recordset.locktype = 3
$recordset.Activecommand = $Command
$CommandtxtUsuario = "select * from usuario" ;INNER JOIN Relaciones ON Usuario.Id_Usuario = Relaciones.Id_Usuario"
$Command.commandtext = $CommandtxtUsuario $recordset.Open ($Command)
$recordset.addnew
$recordset.fields.item("Usuario").value = @USERID
$recordset.fields.item("Nombre_Completo").value = @FullName
$recordset.fields.item("Grupo").value = @PrimaryGroup
$recordset.fields.item("Computadora").value = @WKSTA
$recordset.fields.item("Dia").value = $DIAENTERO
$recordset.fields.item("Hora").value = @TIME
$recordset.update
$recordset.Close
$CommandtxtMaquina = "select * from Maquina" ;INNER JOIN Relaciones ON Usuario.Id_Maquina = Relaciones.Id_Maquina"
$Command.commandtext = $CommandtxtMaquina $recordset.Open ($Command)
$recordset.addnew
$recordset.fields.item("Ip").value = @ipaddress0
$recordset.fields.item("Server").value = @LSERVER
$recordset.fields.item("Cpu").value = @CPU
$recordset.fields.item("So").value = @ProductType
$recordset.fields.item("Idioma").value = @SYSLANG
$recordset.fields.item("MAC").value = @Address
$recordset.fields.item("Service_Pack").value = $Service_Pack
$recordset.fields.item("Install_Date").value = $Install_Date
$recordset.fields.item("Disco").value = $Disco
$recordset.fields.item("Res_Video").value = $Res_Video
$recordset.update
$recordset.Close
I have seen a similar example - here -where sealeopard suggested to use something lie this but cannot work it out code:
SELECT ComputerID FROM tblComputer WHERE ComputerName=@WKSTAINSERT INTO tblSoftware (SoftwareName) Values (SoftwareName)
Thanks again for your help its a big hand.
_________________________
Life is fine.