Recorrer bucle
Publicado por sandra (8 intervenciones) el 19/06/2006 09:48:22
Hola a todos, quisiera saber en que estoy fallando:
tengo unos cuantos recordsert y while pero solo entra en una vez al bucle, y no lo recorre como debiera...
el codigo es el siguiente
cadena=" "
longitud2 = 0
longitud1=0
EstablecerRS RS2, "select rep.* from publica rep where r_id= " & RS1!r_id
While Not RS2.EOF
EstablecerRS RS3, "select cf.* from frontal cf where cf.enlace_tipo='p' and cf.enlace_id =" & RS2!enlace_id
If Not EsVacio(RS3!frontal_id) Then
cfrontal = RS3!frontal_id
End If
EstablecerRS RS4, "select e.ent_nombre from en_tipo e where e.ent_id=" & RS3!ent_id
Do While Not RS4.EOF
longitud1 = longitud1 + Len(RS4!ent_nombre)
cadena = cadena & RS4!ent_nombre
RS4.MoveNext
Loop
EstablecerRS RS5, "select co.* from codadm co where co.enlace_tipo = 'p' and co.enlace_id ='" & RS2!enlace_id & "' and co.frontal_id =" & RS3!frontal_id
cont2 = 0
Do While Not RS5.EOF
longitud2 = longitud2 + 4 + Len(RS5!cod_desc) + 1
cadena = cadena & " - " & RS5!cod_desc & vbCrLf
RS5.MoveNext
Loop
CerrarRS RS5
CerrarRS RS4
CerrarRS RS3
CerrarRS RS2
Wend
solo entra un vez y me pone XXXX el resultado del RS4
pero deberia salir:
los datos devueltos de RS4 y de RS5
xxxxxxx - 23456789
xxxxxxx - 12345099
Gracias por cualquier tipo de ayuda, prestada
tengo unos cuantos recordsert y while pero solo entra en una vez al bucle, y no lo recorre como debiera...
el codigo es el siguiente
cadena=" "
longitud2 = 0
longitud1=0
EstablecerRS RS2, "select rep.* from publica rep where r_id= " & RS1!r_id
While Not RS2.EOF
EstablecerRS RS3, "select cf.* from frontal cf where cf.enlace_tipo='p' and cf.enlace_id =" & RS2!enlace_id
If Not EsVacio(RS3!frontal_id) Then
cfrontal = RS3!frontal_id
End If
EstablecerRS RS4, "select e.ent_nombre from en_tipo e where e.ent_id=" & RS3!ent_id
Do While Not RS4.EOF
longitud1 = longitud1 + Len(RS4!ent_nombre)
cadena = cadena & RS4!ent_nombre
RS4.MoveNext
Loop
EstablecerRS RS5, "select co.* from codadm co where co.enlace_tipo = 'p' and co.enlace_id ='" & RS2!enlace_id & "' and co.frontal_id =" & RS3!frontal_id
cont2 = 0
Do While Not RS5.EOF
longitud2 = longitud2 + 4 + Len(RS5!cod_desc) + 1
cadena = cadena & " - " & RS5!cod_desc & vbCrLf
RS5.MoveNext
Loop
CerrarRS RS5
CerrarRS RS4
CerrarRS RS3
CerrarRS RS2
Wend
solo entra un vez y me pone XXXX el resultado del RS4
pero deberia salir:
los datos devueltos de RS4 y de RS5
xxxxxxx - 23456789
xxxxxxx - 12345099
Gracias por cualquier tipo de ayuda, prestada
Valora esta pregunta


0