ERROR 94 EN TIEMPO DE EJECUCIÓN
hola a todos/as.
por favor, necesito ayuda con este código. si la consulta con encuentra registros, me aparece el error 94 en tiempo de ejecución. ya cambié el código varias veces, pero no puede solucionarlo...
gracias
datPrimaryRS.RecordSource = "Select Sum([Venta]) As Suma From MiTabla Where [Origen]='" & txtOrigen & "' AND [Destino]='" & txtDestino & "' AND [Venta]=" & txtVenta & " AND [Lugar]='" & txtLugar & "'"
datPrimaryRS.Refresh
If datPrimaryRS.Recordset.RecordCount > 0 Then
txtTotalVenta = datPrimaryRS.Recordset.Fields(0)
txtTotalVenta = Format(txtTotalVenta, "#,###,###,#0.00")
Else
txtTotalVenta = 0
txtTotalVenta = Format(txtTotalVenta, "#,###,###,#0.00")
End If
datPrimaryRS.RecordSource = "Select * From MiTabla Where [Origen]='" & txtOrigen & "' AND [Destino]='" & txtDestino & "' AND [Venta]=" & txtVenta & " AND [Lugar]='" & txtLugar & "'"
datPrimaryRS.Refresh
txtCantidadRegistros = datPrimaryRS.Recordset.RecordCount
grdDataGrid.Refresh
End Sub
por favor, necesito ayuda con este código. si la consulta con encuentra registros, me aparece el error 94 en tiempo de ejecución. ya cambié el código varias veces, pero no puede solucionarlo...
gracias
datPrimaryRS.RecordSource = "Select Sum([Venta]) As Suma From MiTabla Where [Origen]='" & txtOrigen & "' AND [Destino]='" & txtDestino & "' AND [Venta]=" & txtVenta & " AND [Lugar]='" & txtLugar & "'"
datPrimaryRS.Refresh
If datPrimaryRS.Recordset.RecordCount > 0 Then
txtTotalVenta = datPrimaryRS.Recordset.Fields(0)
txtTotalVenta = Format(txtTotalVenta, "#,###,###,#0.00")
Else
txtTotalVenta = 0
txtTotalVenta = Format(txtTotalVenta, "#,###,###,#0.00")
End If
datPrimaryRS.RecordSource = "Select * From MiTabla Where [Origen]='" & txtOrigen & "' AND [Destino]='" & txtDestino & "' AND [Venta]=" & txtVenta & " AND [Lugar]='" & txtLugar & "'"
datPrimaryRS.Refresh
txtCantidadRegistros = datPrimaryRS.Recordset.RecordCount
grdDataGrid.Refresh
End Sub
El Err=94 creo que estás tratando de asignar a una caja texto un valor NULL y te da el error.
prueba a cambiar en la línea:
txtTotalVenta=datPrimaryRS.Recordset.Fields(0)
poner los siguiente:
if datPrimaryRS.Recordset.Fields(0)=NULL then
txtTotalVenta = 0
else
txtTotalVenta = datPrimaryRS.Recordset.Fields(0)
end if
Espero que se te resuelva tu problema.
prueba a cambiar en la línea:
txtTotalVenta=datPrimaryRS.Recordset.Fields(0)
poner los siguiente:
if datPrimaryRS.Recordset.Fields(0)=NULL then
txtTotalVenta = 0
else
txtTotalVenta = datPrimaryRS.Recordset.Fields(0)
end if
Espero que se te resuelva tu problema.
