You are on page 1of 8

VERSION 5.

00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmexperto
BorderStyle = 1 'Fixed Single
Caption = "Sistema Experto"
ClientHeight = 4710
ClientLeft = 60
ClientTop = 1020
ClientWidth = 8295
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4710
ScaleWidth = 8295
Begin VB.CommandButton cmdterminar
Caption = "&Terminar"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3360
TabIndex = 12
ToolTipText = "Retornar al S.O."
Top = 3480
Width = 3135
End
Begin VB.ListBox cmbresno
BackColor = &H0080FF80&
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1020
ItemData = "experto1.frx":0000
Left = 3360
List = "experto1.frx":0002
TabIndex = 11
Top = 2400
Width = 3135
End
Begin VB.ListBox cmbressi
BackColor = &H0080FF80&
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1020
ItemData = "experto1.frx":0004
Left = 120
List = "experto1.frx":0006
TabIndex = 10
Top = 2400
Width = 3135
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "experto.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 495
Left = 4920
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 6000
Visible = 0 'False
Width = 4575
End
Begin VB.CommandButton cmdinicio
Caption = "&Iniciar Díalogo"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 9
ToolTipText = "Inicia interface con el S.E."
Top = 3480
Width = 3135
End
Begin VB.TextBox txtnomobj
BackColor = &H00FFFF80&
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 405
Left = 2160
MaxLength = 20
TabIndex = 6
Top = 1320
Width = 4935
End
Begin VB.TextBox txtnomatr
BackColor = &H0000FFFF&
Enabled = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 405
Left = 2160
MaxLength = 20
TabIndex = 2
Top = 840
Width = 4935
End
Begin VB.Frame frmlogo
BackColor = &H00FFFF80&
BorderStyle = 0 'None
ForeColor = &H000000FF&
Height = 735
Left = 0
TabIndex = 1
Top = 0
Width = 12000
Begin VB.Label Label4
Alignment = 2 'Center
BackColor = &H008080FF&
BorderStyle = 1 'Fixed Single
Caption = "S I S T E M A E X P E R T O"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 720
TabIndex = 13
Top = 120
Visible = 0 'False
Width = 6855
End
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 0
Top = 4335
Width = 8295
_ExtentX = 14631
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 5
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 1
Object.Width = 3246
MinWidth = 3246
Text = "SisExperto.vbp"
TextSave = "SisExperto.vbp"
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 6
Alignment = 1
Object.Width = 3529
MinWidth = 3529
TextSave = "05/19/2002"
Object.ToolTipText = "Fecha del Sistema ..."
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 5
TextSave = "02:32 a.m."
Object.ToolTipText = "Hora del Sistema.."
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 1
Enabled = 0 'False
TextSave = "MAYÚS"
Object.ToolTipText = "Mayúsculas On/Off"
EndProperty
BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 2
TextSave = "NÚM"
Object.ToolTipText = "Números On/Off"
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label3
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "Respuestas NO"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 3360
TabIndex = 8
Top = 1800
Width = 3135
End
Begin VB.Label Label2
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "Respuestas SI"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 120
TabIndex = 7
Top = 1800
Width = 3135
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
BackStyle = 0 'Transparent
Caption = "Nombre Objeto:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 5
Top = 1320
Width = 1935
End
Begin VB.Label Label5
BackColor = &H00E0E0E0&
BackStyle = 0 'Transparent
Caption = "Nombre Atributo:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 4
Top = 840
Width = 2175
End
Begin VB.Label Label29
Caption = "Label29"
Height = 15
Left = 8400
TabIndex = 3
Top = 1680
Width = 375
End
End
Attribute VB_Name = "frmexperto"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim wrk As Workspace
Dim db As Database
Dim rsobj As Recordset
Dim rsatr As Recordset
Dim rsresi As Recordset
Dim rsreno As Recordset
Dim n As Integer
Dim ctr As Integer
Dim q As Integer
Dim ctr_atr As Integer
Dim pista As Integer
Dim consulta As String
Dim i As Integer, j As Integer, resp As Integer
Private Sub cmdinicio_Click()
cmbressi.Clear 'limpiar lista respuestas SI
cmbresno.Clear ' limpiar lista respuestas NO
txtnomobj = " "
consulta = "delete from ressi" 'borra contenido tabla respuestas si
db.Execute consulta
consulta = "delete from resno" 'borra contenido tabla respuestas no
db.Execute consulta
'selecciona todos los registros tabla objetos ordenados por codigo
Set rsobj = db.OpenRecordset("select * from objetos order by obj_codigo")
rsobj.MoveLast
ctr = rsobj.RecordCount 'en ctr queda el número de objetos que hay en la tabl
a
rsobj.MoveFirst
For n = 1 To ctr
' selecciona todos los atributos del objeto leido
Set rsatr = db.OpenRecordset("select * from atributos where obj_codigo = '
" & _
rsobj!obj_codigo & "' order by atr_nombre")
rsatr.MoveLast
ctr_atr = rsatr.RecordCount
If ctr_atr > 0 Then 'si el objeto tiene atributos ...
rsatr.MoveFirst
pista = 0
For j = 1 To ctr_atr
txtnomatr = rsatr!atr_nombre 'muestra el nombre del atributo e
n el formulario
'busca el atributo en la tabla de respuestas no..
Set rsreno = db.OpenRecordset("select * from resno where atr_nom
bre = '" & _
rsatr!atr_nombre & "'")
If rsreno.RecordCount = 0 Then 'atributo no esta en lista resp.
NO
'busca el atributo en la tabla de respuestas si...
Set rsresi = db.OpenRecordset("select * from ressi where atr_
nombre = '" & _
rsatr!atr_nombre & "'")
If rsresi.RecordCount = 0 Then 'atributo no esta en lista re
sp. SI
resp = MsgBox("El objeto buscado tiene el atributo... " &
vbCrLf & _
rsatr!atr_nombre & "...", vbYesNo, "Atributos...")
If resp = 6 Then 'si se pica el botón si
'graba el atributo en la tabla respuestas si...
consulta = "insert into ressi values ('" & rsatr!atr_no
mbre & "')"
db.Execute consulta
cmbressi.AddItem rsatr!atr_nombre 'agrega el atributo
a la lista SI
rsatr.MoveNext ' se mueve al sgte. registro de atribu
tos
Else 'si se pica el botón no
'graba el atributo en la tabla de respuestas no...
consulta = "insert into resno values ('" & rsatr!atr_no
mbre & "')"
db.Execute consulta
cmbresno.AddItem rsatr!atr_nombre 'agrega el atributo
a lista NO
pista = 1
Exit For 'desecha este objeto, sale del for y sigue co
n el sgte. objeto
End If
Else 'atributo del objeto ya existe en respuestas SI, sig
ue con el sgte. atributo
rsatr.MoveNext
End If
Else
pista = 1
Exit For
End If
Next j 'finaliza de examinar los atributos de un objeto
If pista = 0 Then 'todas las respuestas fueron SI
q = q + 1
txtnomobj = rsobj!obj_nombre 'muestra el nombre del objeto
MsgBox "El Objeto buscado es ... " & vbCrLf & _
rsobj!obj_nombre & "...", vbOKOnly, "Atención..."
resp = MsgBox("Desea que siga buscando más objetos...", vbYesNo, "
Atributos...")
If resp = 6 Then 'si se pica botón si
txtnomobj = " "
rsobj.MoveNext 'salta al sgte. registro de objetos..
Else
Exit For 'sale del ciclo for ...
End If
Else 'pista = 1 cuando al menos una respuesta fue NO
rsobj.MoveNext
pista = 0
End If
End If
Next n
MsgBox "Terminé de leer toda la DB de objetos...", vbOKOnly, "Data Base..."
If q = 0 Then 'cuando no encontró ningún objeto que satisfaga al usuario...
MsgBox "No hay objetos que satisfagan sus respuestas...", vbOKOnly, "At
ención..."
End If
End Sub
Private Sub cmdterminar_Click()
End
End Sub
Private Sub Form_Load()
On Error Resume Next
ChDir App.Path
Set wrk = CreateWorkspace("conexion", "admin", "", dbUseJet)
Set db = wrk.OpenDatabase("experto.mdb", True)
txtnomobj.Enabled = False
txtnomatr.Enabled = False
End Sub
'cuando se mueve el mouse encima del formulario...
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y A
s Single)
Label4.Visible = False
End Sub
'cuando se mueve el mouse encima de este control...
Private Sub frmlogo_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
Label4.Visible = True
End Sub

You might also like