Hi all,
First at all saying Im a beginer programing. I would need to read all record from a table one by one untill the end of the file and passing to a variable to use in the screen. I have got to connect to the access DB and insert values in a table but I cant get extract the values from a table to variable.....
Some help would be helpful. Thanks for all.
This is part of the code If have used to insert values into a table.
.......................
Const DBNAME = "C:\Documents and Settings\as05964\My Documents\LINEUP\LINEUPV2.mdb"
Dim connection_string As String, cn As Object, cmd As Object
connection_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBNAME & ";Persist Security Info=False"
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
cn.ConnectionString = connection_string
cn.Open
cmd.ActiveConnection = cn
.......
Cadena = Vtam.Screen.getstring(I, 4, 7)
Do Until Cadena = ""
Cadena = Vtam.Screen.getstring(I, 10, 8)
Linea = Cadena
V1 = Vtam.Screen.getstring(I, 50, 7)
V1 = Trim(V1)
V2 = Vtam.Screen.getstring(I, 58, 7)
V2 = Trim(V2)
V3 = Vtam.Screen.getstring(I, 66, 7)
V3 = Trim(V3)
V4 = Vtam.Screen.getstring(I, 74, 7)
V4 = Trim(V4)
Linea = Linea & " " & V1 & " " & V2 & " " & V3 & " " & V4
'Introducción en fichero resultado
strSQL = "insert into Nuevo_Xceif36h (VEHICLE_ID,PACK,SHIP,OPN,CLSE) values ('" & Cadena & "','" & V1 & "','" & V2 & "','" & V3 & "','" & V4 & "')"
cmd.CommandText = strSQL
cmd.Execute
First at all saying Im a beginer programing. I would need to read all record from a table one by one untill the end of the file and passing to a variable to use in the screen. I have got to connect to the access DB and insert values in a table but I cant get extract the values from a table to variable.....
Some help would be helpful. Thanks for all.
This is part of the code If have used to insert values into a table.
.......................
Const DBNAME = "C:\Documents and Settings\as05964\My Documents\LINEUP\LINEUPV2.mdb"
Dim connection_string As String, cn As Object, cmd As Object
connection_string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBNAME & ";Persist Security Info=False"
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
cn.ConnectionString = connection_string
cn.Open
cmd.ActiveConnection = cn
.......
Cadena = Vtam.Screen.getstring(I, 4, 7)
Do Until Cadena = ""
Cadena = Vtam.Screen.getstring(I, 10, 8)
Linea = Cadena
V1 = Vtam.Screen.getstring(I, 50, 7)
V1 = Trim(V1)
V2 = Vtam.Screen.getstring(I, 58, 7)
V2 = Trim(V2)
V3 = Vtam.Screen.getstring(I, 66, 7)
V3 = Trim(V3)
V4 = Vtam.Screen.getstring(I, 74, 7)
V4 = Trim(V4)
Linea = Linea & " " & V1 & " " & V2 & " " & V3 & " " & V4
'Introducción en fichero resultado
strSQL = "insert into Nuevo_Xceif36h (VEHICLE_ID,PACK,SHIP,OPN,CLSE) values ('" & Cadena & "','" & V1 & "','" & V2 & "','" & V3 & "','" & V4 & "')"
cmd.CommandText = strSQL
cmd.Execute