Foros del Web » Programación para mayores de 30 ;) » .NET »

Visual Basic 6.0

Estas en el tema de Visual Basic 6.0 en el foro de .NET en Foros del Web. Quien me podria ayudar con un codigo que tengo lo que pasa es que esta conectado con excel y en el codigo que voy a ...
  #1 (permalink)  
Antiguo 22/01/2010, 09:57
 
Fecha de Ingreso: enero-2010
Mensajes: 2
Antigüedad: 14 años, 2 meses
Puntos: 0
Visual Basic 6.0

Quien me podria ayudar con un codigo que tengo lo que pasa es que esta conectado con excel y en el codigo que voy a mostrar a continuacion me esta agregando trimestres por lote y uno por uno pero cuando encuentra que ya fue agregado el numero de registro cambia


' verifica si existe el ruc, trim (1,2,3,4) y periodo ya que no se debe repetir excepto que el trim sea 5



If idimaruc > 0 Then

For y = 0 To idimaruc
SQLC3 = "select ACT_COD, EMP_RUC " & _
" from activida where emp_ruc='" & aruc(y) & "' and ACT_TRIM = " & Right(Me.CboTrim.Value, 1) & " and ACT_PERIOD= " & Me.Cboperiodo.Value
rs3.Open SQLC3, cnn, adOpenDynamic, adLockOptimistic


If Not rs3.EOF Then

Select Case CheckBox1.Value
Case True
USQL = "UPDATE activida set " & Trim(Me.Cbfecha.Value) & " ='" & Format(DTPicker1.Value, "dd/mm/yyyy") & _
"',ACT_PERIOD = " & Me.Cboperiodo.Value & _
",ACT_TRIM = " & Right(Me.CboTrim.Value, 1) & _
",username ='" & Me.lbluser.Caption & _
"',userdate ='" & Format(Date, "dd/mm/yyyy") & "'" & _
" where ACT_COD = " & rs3(0)

Case False
USQL = "UPDATE activida set ACT_PERIOD = " & Me.Cboperiodo.Value & _
",ACT_TRIM = " & Right(Me.CboTrim.Value, 1) & _
",username ='" & Me.lbluser.Caption & _
"',userdate ='" & Format(Date, "dd/mm/yyyy") & "'" & _
" where ACT_COD = " & rs3(0)

End Select

cnn.Execute USQL

Else

iacttot1 = iacttot + y + 1

Select Case CheckBox1.Value
Case True
ISQL = "INSERT INTO activida " & "(ACT_COD,EMP_RUC, " & Trim(Me.Cbfecha.Value) & " , ACT_TRIM ,ACT_PERIOD , ACT_SITUAC ,username, userdate ) VALUES(" & _
iacttot1 & _
",'" & aruc(y) & _
"','" & Format(DTPicker1.Value, "dd/mm/yyyy") & _
"'," & Right(Me.CboTrim.Value, 1) & _
"," & Me.Cboperiodo.Value & _
",'" & "01" & _
"','" & Me.lbluser.Caption & _
"','" & Format(Date, "dd/mm/yyyy") & "')"
Case False
ISQL = "INSERT INTO activida " & "(ACT_COD,EMP_RUC, ACT_TRIM ,ACT_PERIOD , ACT_SITUAC ,username, userdate ) VALUES(" & _
iacttot1 & _
",'" & aruc(y) & _
"'," & Right(Me.CboTrim.Value, 1) & _
"," & Me.Cboperiodo.Value & _
",'" & "01" & _
"','" & Me.lbluser.Caption & _
"','" & Format(Date, "dd/mm/yyyy") & "')"
End Select
cnn.Execute ISQL
End If
rs3.Close

Next y

MsgBox "Tabla Actualizada.", vbInformation, "Aviso"

End If

Call Desconectar



End Sub

Etiquetas: basic, visual
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:45.