AYUDA URGENTE!!!!!!!!
Publicado por jhon b (27 intervenciones) el 23/08/2005 18:02:45
BUENOS DÍAS, TENGO UN PROBLEMA UN PROGRAMA QUE ESTOY DISEÑANDO. EN UN COMBOBOX SELECCIONO UN ELEMENTO Y LUEGO ACCEDO A UNA TABLA DE MI BD EN ACCESS PARA RECUPERAR UN REGISTRO. EL PROBLEMA ES QUE ME RECUPERA ESTE REGISTRO INFINITAS VECES Y EN LA TABLA SOLO ESTÁ 2 VECES, QUE ESTARÉ HACIENDO MAL... AHI LES VA EL CÓDIGO
Private Sub Combo1_Click()
For i = 0 To 49
If PuestoTrabajo(i).BackColor = &H80FFFF Then
If (PuestoTrabajo(i).Text = "") Then
PuestoTrabajo(i).Text = Combo1.Text
Else
PuestoTrabajo(i).Text = PuestoTrabajo(i).Text & ", " & Combo1.Text
End If
Index = Combo1.ListIndex
CboCod.Text = CboCod.List(Index)
'Buscamos el día y la hora que empieza
fncOtroAsignarHoraFila (i)
hora = Horafila
diae = fncAsignardia(CInt(i))
Label1.Caption = Label1.Caption & ", " & hora & " dia: " & diae
pos = pos + 1
End If
Next i
ESTA ES LA PARTE QUE PONE PROBLEMA
Set tblhor = Nothing
Set tblhor = CreateObject("adodb.recordset")
tblhor.Open "SELECT * FROM tblHorarioPTrabajo WHERE PtrCodigo = " & CInt(CodPT) & "", Conexion
Label1.Caption = tblhor(0)
'tablahorario.Open "Select count(PtrCodigo) from tblHorarioPTrabajo where PtrCodigo=" & CodPT & ", Conexion"
j = 0
While Not tblhor.EOF
With buscAsig(j)
.Auxced = CInt(CboCod.List(Index))
.Cod = CodPT
.Dia = tblhor(1)
.fin = tblhor(3)
.inicio = tblhor(2)
End With
j = j + 1
Wend
ESTE CICLO PASADO SE QUEDA EL PROGRAMA Y SALE UN ERROR DE DESBORDE DEBIDO AL TAMAÑO MAXIMO DE LA ESTRUCTURA buscAsig QUE ES DE 100
For i = 0 To j
With buscAsig(i)
Label1.Caption = Label1.Caption & ", " & hora & .Auxced & .Cod & .Dia & .inicio & .fin
End With
Next i
Combo1.RemoveItem (Index)
End Sub
POR SI ACASO ACA ESTÁ LA DEFINICIÓN DE LA ESTRUCTURA
Public Type Asignar
Auxced As Integer
Cod As Integer
Dia As Integer
inicio As Date
fin As Date
End Type
Public buscAsig(100) As Asignar
Private Sub Combo1_Click()
For i = 0 To 49
If PuestoTrabajo(i).BackColor = &H80FFFF Then
If (PuestoTrabajo(i).Text = "") Then
PuestoTrabajo(i).Text = Combo1.Text
Else
PuestoTrabajo(i).Text = PuestoTrabajo(i).Text & ", " & Combo1.Text
End If
Index = Combo1.ListIndex
CboCod.Text = CboCod.List(Index)
'Buscamos el día y la hora que empieza
fncOtroAsignarHoraFila (i)
hora = Horafila
diae = fncAsignardia(CInt(i))
Label1.Caption = Label1.Caption & ", " & hora & " dia: " & diae
pos = pos + 1
End If
Next i
ESTA ES LA PARTE QUE PONE PROBLEMA
Set tblhor = Nothing
Set tblhor = CreateObject("adodb.recordset")
tblhor.Open "SELECT * FROM tblHorarioPTrabajo WHERE PtrCodigo = " & CInt(CodPT) & "", Conexion
Label1.Caption = tblhor(0)
'tablahorario.Open "Select count(PtrCodigo) from tblHorarioPTrabajo where PtrCodigo=" & CodPT & ", Conexion"
j = 0
While Not tblhor.EOF
With buscAsig(j)
.Auxced = CInt(CboCod.List(Index))
.Cod = CodPT
.Dia = tblhor(1)
.fin = tblhor(3)
.inicio = tblhor(2)
End With
j = j + 1
Wend
ESTE CICLO PASADO SE QUEDA EL PROGRAMA Y SALE UN ERROR DE DESBORDE DEBIDO AL TAMAÑO MAXIMO DE LA ESTRUCTURA buscAsig QUE ES DE 100
For i = 0 To j
With buscAsig(i)
Label1.Caption = Label1.Caption & ", " & hora & .Auxced & .Cod & .Dia & .inicio & .fin
End With
Next i
Combo1.RemoveItem (Index)
End Sub
POR SI ACASO ACA ESTÁ LA DEFINICIÓN DE LA ESTRUCTURA
Public Type Asignar
Auxced As Integer
Cod As Integer
Dia As Integer
inicio As Date
fin As Date
End Type
Public buscAsig(100) As Asignar
Valora esta pregunta


0