generar txt
no se quien me podria ayudar, Estoy haciendo un programa en el cual debo de generar un archivo txt pero tengo que extraer la informacion de una db access 2000 pero no puedo ( ya tengo la conexion a la db, estoy utilizando el objeto ADODC1 y genero el archivo pero lo genero en blanco) no se como pueda copiar los datos de la db y colocarlos en el txt.
mil gracias por su tiempo y espero que alguien me pueda ayudar.. gracias
mil gracias por su tiempo y espero que alguien me pueda ayudar.. gracias
hola semex
ahi va un codigo ojala te sirva
SQL$ = " SELECT rut, dv, nombre, appaterno, apmaterno"
SQL$ = SQL$ & " FROM persona "
Set vgrst_Tablaexiste = Nothing
vgrst_Tablaexiste.Open SQL, vgcnn, adOpenForwardOnly, adLockReadOnly
e$ = ""
Do While Not vgrst_Tablaexiste.EOF
e$ = e$ & Format(vgrst_Tablaexiste!rut, "0000000000")
e$ = e$ & vgrst_Tablaexiste!dv
e$ = e$ & left(RTrim(vgrst_Tablaexiste!nombres) & " " & (RTrim(vgrst_Tablaexiste!appaterno)) & " " & (RTrim(vgrst_Tablaexiste!apmaterno)) & Space(65), 65)
e$ = e$ & vbNewLine
vgrst_Tablaexiste.movenext
loop
vgrst_Tablaexiste.close
Open "c:documentosclientes-" & Format$(Now, "ddmmyyyy") & ".txt" For Output As #1
Print #1, e$
MsgBox "Batch Generado", vbExclamation, ""
Close #1
ahi va un codigo ojala te sirva
SQL$ = " SELECT rut, dv, nombre, appaterno, apmaterno"
SQL$ = SQL$ & " FROM persona "
Set vgrst_Tablaexiste = Nothing
vgrst_Tablaexiste.Open SQL, vgcnn, adOpenForwardOnly, adLockReadOnly
e$ = ""
Do While Not vgrst_Tablaexiste.EOF
e$ = e$ & Format(vgrst_Tablaexiste!rut, "0000000000")
e$ = e$ & vgrst_Tablaexiste!dv
e$ = e$ & left(RTrim(vgrst_Tablaexiste!nombres) & " " & (RTrim(vgrst_Tablaexiste!appaterno)) & " " & (RTrim(vgrst_Tablaexiste!apmaterno)) & Space(65), 65)
e$ = e$ & vbNewLine
vgrst_Tablaexiste.movenext
loop
vgrst_Tablaexiste.close
Open "c:documentosclientes-" & Format$(Now, "ddmmyyyy") & ".txt" For Output As #1
Print #1, e$
MsgBox "Batch Generado", vbExclamation, ""
Close #1
