Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/10/2004, 13:40
zack
 
Fecha de Ingreso: mayo-2004
Mensajes: 195
Antigüedad: 19 años, 11 meses
Puntos: 0
duda en visual basic

Hola a todos:

Quisiera que me dijieran como puedo llamar un modulo al momento de ingresar los datos a la base de datos

im Con As ADODB.Connection
Dim Sql, sql2, conexion As String
Dim recorrer, rst As ADODB.Recordset
Dim Graba As ADODB.Recordset
Private Sub btn_agregar_Click()
calcular
Graba.AddNew
Graba!fecha = Textfecha
Graba!n_guia = Textguia
Graba!nombre_proveedor = Textnombre
Graba!cantidad_trozo = Val(Textcantidad)
Graba!diametro = Val(Textdiametro ^ 2)
Graba!largo = Val(textlargo)
Graba!volumen = Val(textlargo * Textdiametro)
Graba!volumen = Textvolumen
MsgBox Graba!volumen
Graba.Update
End Sub
Private Sub btn_mostrar_Click()
Sql = "Select * From trozo"
Set recorrer = Con.Execute(Sql)
If recorrer.BOF And recorrer.EOF Then
MsgBox "Dato no encontrado"
Else
recorrer.MoveFirst
Textfecha = recorrer!fecha
Textguia = recorrer!n_guia
Textnombre = recorrer!nombre_proveedor
Textcantidad = recorrer!cantidad_trozo

End If
End Sub
Private Sub Form_Load()
Set Con = New ADODB.Connection
Set recorrer = New ADODB.Recordset
conexion = "Microsoft.Jet.OLEDB.4.0;Data Source=C:\trozos.mdb;Persist Security Info=False"
Con.Provider = conexion
Con.Open
Set Graba = New ADODB.Recordset
Graba.CursorType = adOpenDynamic
Graba.LockType = adLockOptimistic
Graba.Open "trozo", Con, , , adCmdTable
End Sub



Y este es la funcion del modulo el cual quiero llamar

Public Function calcular()
cantidad = Val(Textcantidad)
diametro = (Val(Textdiametro * Textdiametro))
suma = suma + diametro
largo = textlargo
volumen = Val(suma) + Val(Textvolumen)


End Function

Gracias

Zack.