Codificaciones

Páginas: 19 (4734 palabras) Publicado: 27 de julio de 2012
PARA CODIFICAR EL BOTON SALIR
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim A As Integer
A = MsgBox("DESEA SALIR DEL PROGRAMA", 4 + 256 + 48, "SALIR")
If A = 6 Then
End
Else
A = 7
Cancel = 1
End If
End Sub

PROYECTO COSTO DE PRODUCCIÓN
Definir variables en General Declaraciones.
Dim tabla As Recordset
Dim error As Integer
Dim codingreso As IntegerDim BANDERA As Integer
Dim consulta As String
Dim cuantos As Recordset

Codificación del Botón Buscar por Nombre de Empresa
Private Sub cmdBuscar_Click()
Frame1.Visible = False
Dim buscar As String
buscar = InputBox("INGRESE EL NOMBRE DE LA EMPRESA A CONSULTAR", "Busqueda por Nombre De Empresa")
buscar = StrConv(Trim(buscar), 3)
If Trim(buscar) <> "" Then
abrir
consulta ="select*from COSTOS where EMPRESA like '" & buscar & "*'"
Set tabla = BASE.OpenRecordset("select * from COSTOS where EMPRESA like '" & buscar & "*'")
consulta = "SELECT COUNT (*) AS CONTAR FROM COSTOS WHERE EMPRESA like '" & buscar & "*'"
Set cuantos = BASE.OpenRecordset(consulta)
If cuantos!contar <> 0 Then
If cuantos!contar > 0 Then
Marco.Visible = TrueMarco.Enabled = True
cmdSalir.Enabled = True
GridBuscar.Rows = 1
GridBuscar.ColWidth(0) = 500
GridBuscar.ColWidth(1) = 2000
GridBuscar.ColWidth(2) = 2000
GridBuscar.ColWidth(3) = 2000
While Not tabla.EOF
GridBuscar.AddItem tabla!idNUMERO & Chr(9) & tabla!Empresa & Chr(9) & tabla!TIEMPOS & Chr(9) & tabla!TOTAL
tabla.MoveNext
Wend
Else
MOSTRARLOSCAMPOS
cmdaceptar.Enabled =False
End If
Else
MsgBox "NO SE ENCUENTRA ESE NOMBRE", 48, Me.Caption
End If
tabla.Close
cuantos.Close
cerrar
End If
End Sub

En General, creamos una subrutina
Sub MOSTRARLOSCAMPOS()
txtcodigo.Text = tabla!idNUMERO
txtempresa.Text = tabla!Empresa
txtaccesorios.Text = tabla!ACCESORIOS
txtamortizacion.Text = tabla!AMORTIZACION
txtcombustibles.Text = tabla!COMBUSTIBLEStxtcomunicaciones.Text = tabla!COMUNICACIONES
txtdepreciacion.Text = tabla!DEPRECIACION
txtenergia.Text = tabla!ENERGIA
txtfinancieros.Text = tabla!GASTOSFINANCIEROS
txtgastos.Text = tabla!GASTOSDEADMINISTRACIONYVENTAS
txtinsumos.Text = tabla!INSUMOSYMATERIAPRIMA
txtmano.Text = tabla!MANODEOBRA
txtmanoind.Text = tabla!MANODEOBRAINDIRECTA
txtmateriales.Text = tabla!MATERIALES
txtpapeleria.Text =tabla!PAPELERIA
txtproyecto.Text = tabla!PROYECTO
txtsalarios.Text = tabla!SALARIOS
FECHA1.Value = tabla!TIEMPO
FECHA2.Value = tabla!TIEMPO1
txtTiempo.Text = tabla!TIEMPOS
End Sub

Sub limpiar()
txtcodigo.Text = ""
txtTiempo.Text = ""
txtaccesorios.Text = ""
txtamortizacion.Text = ""
txtcombustibles.Text = ""
txtcomunicaciones.Text = ""
txtdepreciacion.Text = ""
txtempresa.Text = ""txtenergia.Text = ""
txtfinancieros.Text = ""
txtgastos.Text = ""
txtinsumos.Text = ""
txtmano.Text = ""
txtmanoind.Text = ""
txtmateriales.Text = ""
txtpapeleria.Text = ""
txtproyecto.Text = ""
txtsalarios.Text = ""
txtsubtotal1.Text = ""
txtsubtotal2.Text = ""
txtsubtotal3.Text = ""
txttotal.Text = ""
Option1 = False
Option2 = False
End Sub

Sub desabilitar()
txtcodigo.Enabled =False
txtinsumos.Enabled = False
txtmano.Enabled = False
txtmateriales.Enabled = False
txtmanoind.Enabled = False
txtenergia.Enabled = False
txtaccesorios.Enabled = False
txtcombustibles.Enabled = False
txtamortizacion.Enabled = False
txtdepreciacion.Enabled = False
txtgastos.Enabled = False
txtsalarios.Enabled = False
txtpapeleria.Enabled = False
txtcomunicaciones.Enabled = Falsetxtfinancieros.Enabled = False
End Sub

Sub HABILITAR()
txtcodigo.Enabled = True
txtinsumos.Enabled = True
txtmano.Enabled = True
txtmateriales.Enabled = True
txtmanoind.Enabled = True
txtenergia.Enabled = True
txtaccesorios.Enabled = True
txtcombustibles.Enabled = True
txtamortizacion.Enabled = True
txtdepreciacion.Enabled = True
txtgastos.Enabled = True
txtsalarios.Enabled = True...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Codificadores
  • Codificadores
  • Codificaciones
  • Codificadora
  • Codificadores
  • Codificadores
  • Codificadores
  • codificaciones

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS