Dim base As Database
Dim b As Recordset
Private Sub Command1_Click()
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
b.MoveFirst
Dim ApExcel As Variant
Set ApExcel = CreateObject("Excel.application")
ApExcel.Visible = True
ApExcel.Workbooks.Open ("\\pc_soporte\c$\soporte\Formulario de Soporte Tecnico a Terreno.xls")
Do While b.EOF = False
If b("folio_atencion") = Text1.Text Then
Text2.Text = b("usuario_atencion")
Text3.Text = b("direccion_depto")
ApExcel.cells(1, 1).Font.Size = 12
ApExcel.cells(8, 7).formula = b("folio_atencion")
ApExcel.cells(9, 4).formula = b("usuario_atencion") 'nombre usuario
ApExcel.cells(9, 7).formula = b("fono_anexo") 'fono anexo
ApExcel.cells(10, 4).formula = b("direccion_depto") 'direccion
ApExcel.cells(10, 7).formula = b("n_oficina") 'oficina
ApExcel.cells(11, 7).formula = b("tecnico_asignado") 'tecnico
ApExcel.cells(14, 3).formula = b("problema_descrito") 'problema
b.MoveNext
Else
b.MoveNext
End If
Loop
Set ApExcel = Nothing
End Sub
Private Sub Form_Load()
Set a = OpenDatabase("\\pc_soporte\c$\soporte\db_soporte.mdb") 'ASIGNO A LA VARIABLE "A" LA DIRECCION DE DONDE SE ENCUENTRA LA BASE DE DATOS
Set b = a.OpenRecordset("maestro_atenciones") 'ASIGNO A LA VARIABLE "B" LA TABLA DE LA BASE DE DATOS LA CUAL UTILIZARA
If b.RecordCount = 0 Then
MsgBox "No Existen Registros", vbInformation, "Por Favor Ingrese"
Else
b.MoveFirst
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Command2_Click
End Sub