Consulta de Access desde el editor de visual
Hola,
Estoy trabajando en Access y programando aqui tambien, mi problemita creo que es algo sencillo pero no se como hacerlo, estoy en un formulario en donde tengo los campos de mi consulta la cuestion es que los resultados de esos campos son el promedio de 3 campos, yo ya se como hacer esto pero el problemita esta en que quiero que al presionar el boton de calcular me haga el calculo en todos los registros de la consulta de la base de datos y no que yo tenga que presionar el boton por cada registrover para que haga dicho calculo. asi tengo mi codigo
Private Sub MAPEO_Click()
Dim CONT1 As Integer
Dim CONT2 As Integer
Dim CONT3 As Integer
Dim CONT4 As Integer
Dim CONT5 As Integer
ORIEN_COM_Y = ORIC_Y
ORIEN_COM_Y = Format(ORIEN_COM_Y, "0.0")
ORIEN_COM_J = ORIC_J
ORIEN_COM_J = Format(ORIEN_COM_J, "0.0")
ORIEN_COM_S = ORIC_S
ORIEN_COM_S = Format(ORIEN_COM_S, "0.0")
ORIEN_COM_O = ORIC_O
ORIEN_COM_O = Format(ORIEN_COM_O, "0.0")
CONT5 = 0
If ORIEN_COM_J > 0 Then
CONT5 = CONT5 + 1
End If
If ORIEN_COM_S > 0 Then
CONT5 = CONT5 + 1
End If
If ORIEN_COM_O > 0 Then
CONT5 = CONT5 + 1
End If
PROME_ORIEN = ([ORIEN_COM_J] + [ORIEN_COM_S] + [ORIEN_COM_O]) / CONT5
PROME_ORIEN = Format(PROME_ORIEN, "0.0")
ORIEN_COM_IND = [PROME_ORIEN] * 2
ORIEN_COM_IND = Format(ORIEN_COM_IND, "0")
End Sub
Estoy trabajando en Access y programando aqui tambien, mi problemita creo que es algo sencillo pero no se como hacerlo, estoy en un formulario en donde tengo los campos de mi consulta la cuestion es que los resultados de esos campos son el promedio de 3 campos, yo ya se como hacer esto pero el problemita esta en que quiero que al presionar el boton de calcular me haga el calculo en todos los registros de la consulta de la base de datos y no que yo tenga que presionar el boton por cada registrover para que haga dicho calculo. asi tengo mi codigo
Private Sub MAPEO_Click()
Dim CONT1 As Integer
Dim CONT2 As Integer
Dim CONT3 As Integer
Dim CONT4 As Integer
Dim CONT5 As Integer
ORIEN_COM_Y = ORIC_Y
ORIEN_COM_Y = Format(ORIEN_COM_Y, "0.0")
ORIEN_COM_J = ORIC_J
ORIEN_COM_J = Format(ORIEN_COM_J, "0.0")
ORIEN_COM_S = ORIC_S
ORIEN_COM_S = Format(ORIEN_COM_S, "0.0")
ORIEN_COM_O = ORIC_O
ORIEN_COM_O = Format(ORIEN_COM_O, "0.0")
CONT5 = 0
If ORIEN_COM_J > 0 Then
CONT5 = CONT5 + 1
End If
If ORIEN_COM_S > 0 Then
CONT5 = CONT5 + 1
End If
If ORIEN_COM_O > 0 Then
CONT5 = CONT5 + 1
End If
PROME_ORIEN = ([ORIEN_COM_J] + [ORIEN_COM_S] + [ORIEN_COM_O]) / CONT5
PROME_ORIEN = Format(PROME_ORIEN, "0.0")
ORIEN_COM_IND = [PROME_ORIEN] * 2
ORIEN_COM_IND = Format(ORIEN_COM_IND, "0")
End Sub