

Fitxer: m5p3.frm
Definició dels objectes. Interfície d'usuari
Recordeu que això no ho podeu editar directament. Per fer-ho incorporeu nous objectes
de la paleta en el vostre formulari. I per canviar els valors seleccioneu l'objecte i
escolliu la propietat a canviar en la finestra Properties.
VERSION 5.00
Begin VB.Form frmDadesInternet
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Base de dades d'adreces Internet"
ClientHeight = 4845
ClientLeft = 1845
ClientTop = 1500
ClientWidth = 6615
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 4845
ScaleWidth = 6615
Begin VB.TextBox txtTextACercar
Appearance = 0 'Flat
Height = 285
Left = 5040
TabIndex = 23
Top = 3960
Width = 1455
End
Begin VB.ComboBox cboCamps
Appearance = 0 'Flat
Height = 300
Left = 3240
Style = 2 'Dropdown List
TabIndex = 22
Top = 3960
Width = 975
End
Begin VB.CommandButton cmdCercarSegüent
Appearance = 0 'Flat
Caption = "Cercar següent"
Height = 375
Left = 1560
TabIndex = 21
Top = 3960
Width = 1455
End
Begin VB.CommandButton cmdCercar
Appearance = 0 'Flat
Caption = "Cercar"
Height = 375
Left = 360
TabIndex = 20
Top = 3960
Width = 1095
End
Begin VB.CommandButton cmdSegüent
Appearance = 0 'Flat
Caption = "Següent"
Height = 375
Left = 3120
TabIndex = 19
Top = 3360
Width = 855
End
Begin VB.CommandButton cmdEsborrar
Appearance = 0 'Flat
Caption = "Esborra"
Height = 375
Left = 5040
TabIndex = 18
Top = 3360
Width = 735
End
Begin VB.CommandButton cmdNou
Appearance = 0 'Flat
Caption = "Nou"
Height = 375
Left = 4440
TabIndex = 17
Top = 3360
Width = 495
End
Begin VB.CommandButton cmdAnterior
Appearance = 0 'Flat
Caption = "Anterior"
Height = 375
Left = 2160
TabIndex = 16
Top = 3360
Width = 855
End
Begin VB.CommandButton cmdÚltim
Appearance = 0 'Flat
Caption = "Últim"
Height = 375
Left = 1080
TabIndex = 15
Top = 3360
Width = 615
End
Begin VB.CommandButton cmdPrimer
Appearance = 0 'Flat
Caption = "Primer"
Height = 375
Left = 360
TabIndex = 14
Top = 3360
Width = 615
End
Begin VB.TextBox txtInterès
Appearance = 0 'Flat
DataField = "Interès"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 6
Top = 2400
Width = 3855
End
Begin VB.TextBox txtNotes
Appearance = 0 'Flat
DataField = "Notes"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 5
Top = 2040
Width = 3855
End
Begin VB.TextBox txtTelèfon
Appearance = 0 'Flat
DataField = "Telèfon"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 4
Top = 1680
Width = 3855
End
Begin VB.TextBox txtTemes
Appearance = 0 'Flat
DataField = "Temes"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 3
Top = 1320
Width = 3855
End
Begin VB.TextBox txtConnexió
Appearance = 0 'Flat
DataField = "Connexió"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 2
Top = 960
Width = 3855
End
Begin VB.TextBox txtAdreça
Appearance = 0 'Flat
DataField = "Adreça"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 1
Top = 600
Width = 3855
End
Begin VB.TextBox txtID
Appearance = 0 'Flat
DataField = "ID"
DataSource = "datInternet"
Height = 285
Left = 1920
TabIndex = 0
Top = 240
Width = 3855
End
Begin VB.Data datInternet
Appearance = 0 'Flat
Caption = "Base de dades d'Internet"
Connect = "Access"
DatabaseName = "Direc.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 375
Left = 360
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Adreces"
Top = 2880
Width = 5415
End
Begin VB.Label Label8
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Text:"
ForeColor = &H80000008&
Height = 255
Left = 4440
TabIndex = 24
Top = 3960
Width = 495
End
Begin VB.Label Label7
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Interès:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 13
Top = 2400
Width = 1455
End
Begin VB.Label Label6
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Notes:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 12
Top = 2040
Width = 1455
End
Begin VB.Label Label5
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Telèfon:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 11
Top = 1680
Width = 1455
End
Begin VB.Label Label4
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Temes:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 10
Top = 1320
Width = 1455
End
Begin VB.Label Label3
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Connexió"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 9
Top = 960
Width = 1455
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Adreça Internet:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 8
Top = 600
Width = 1455
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "ID:"
ForeColor = &H80000008&
Height = 255
Left = 360
TabIndex = 7
Top = 240
Width = 1455
End
End
Codi del programa. Programació de respostes a events
Option Explicit
Dim Criteri As String
Const IDYES = 6
Const MB_OK = 0
Const MB_ICONSTOP = 16
Const MB_YESNO = 4
Private Sub cmdAnterior_Click()
On Error GoTo ErrcmdAnterior
datInternet.Recordset.MovePrevious
ErrcmdAnterior:
End Sub
Private Sub cmdCercar_Click()
Dim Camp As String
Camp = "[" + cboCamps.List(cboCamps.ListIndex) + "]"
Criteri = Camp + " Like " + """" + txtTextACercar + "*"""
datInternet.Recordset.FindFirst Criteri
End Sub
Private Sub cmdEsborrar_Click()
On Error GoTo ErrcmdEsborrar
Dim Contestació As Integer
Dim Missatge As String
Missatge = "Voleu esborrar el missatge que hi ha a la pantalla?"
Contestació = MsgBox(Missatge, MB_ICONSTOP + MB_YESNO)
If Contestació = IDYES Then
datInternet.Recordset.Delete
datInternet.Recordset.MoveNext
If datInternet.Recordset.EOF Then
datInternet.Recordset.MovePrevious
End If
End If
ErrcmdEsborrar:
MsgBox "Hi ha hagut un error", MB_OK
End Sub
Private Sub cmdNou_Click()
datInternet.Recordset.AddNew
End Sub
Private Sub cmdPrimer_Click()
datInternet.Recordset.MoveFirst
End Sub
Private Sub cmdSegüent_Click()
On Error GoTo ErrcmdSegüent
datInternet.Recordset.MoveNext
ErrcmdSegüent:
End Sub
Private Sub cmdÚltim_Click()
datInternet.Recordset.MoveLast
End Sub
Private Sub Form_Load()
cboCamps.AddItem "ID"
cboCamps.AddItem "Adreça"
cboCamps.AddItem "Connexió"
cboCamps.AddItem "Temes"
cboCamps.AddItem "Telèfon"
cboCamps.AddItem "Notes"
cboCamps.AddItem "Interès"
cboCamps.ListIndex = 0
End Sub
Private Sub txtTextACercar_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then cmdCercar_Click
End Sub