VERSION 5.00
Begin VB.Form Txt_id
Caption = "Form1"
ClientHeight = 5190
ClientLeft = 60
ClientTop = 450
ClientWidth = 7860
LinkTopic = "Form1"
ScaleHeight = 5190
ScaleWidth = 7860
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Cmd_tutti
Caption = "Visualizza tutti"
Height = 495
Left = 5880
TabIndex = 14
Top = 2520
Width = 1695
End
Begin VB.CommandButton Cmd_trova
Caption = "Ricerca per cognome"
Height = 495
Left = 5880
TabIndex = 13
Top = 1920
Width = 1695
End
Begin VB.CommandButton Cmd_cancella
Caption = "Cancella amico"
Height = 495
Left = 5880
TabIndex = 12
Top = 1320
Width = 1695
End
Begin VB.CommandButton Cmd_Conferma
Caption = "Conferma"
Enabled = 0 'False
Height = 495
Left = 5880
TabIndex = 11
Top = 720
Width = 1695
End
Begin VB.CommandButton Cmd_nuovo
Caption = "Nuovo amico"
Height = 495
Left = 5880
TabIndex = 10
Top = 120
Width = 1695
End
Begin VB.TextBox txt_eta
DataField = "anni"
DataSource = "dt_anagrafe"
Height = 375
Left = 2280
TabIndex = 3
Top = 2520
Width = 2415
End
Begin VB.TextBox Txt_telefono
DataField = "telefono"
DataSource = "dt_anagrafe"
Height = 375
Left = 2280
TabIndex = 4
Top = 3240
Width = 2415
End
Begin VB.TextBox Text1
DataField = "ID"
DataSource = "dt_anagrafe"
Enabled = 0 'False
Height = 375
Left = 2280
TabIndex = 5
Top = 3960
Width = 2415
End
Begin VB.TextBox txt_nome
DataField = "nome"
DataSource = "dt_anagrafe"
Height = 375
Left = 2280
TabIndex = 2
Top = 1800
Width = 2415
End
Begin VB.TextBox txt_cognome
DataField = "cognome"
DataSource = "dt_anagrafe"
Height = 375
Left = 2280
TabIndex = 1
Top = 960
Width = 2415
End
Begin VB.Data dt_anagrafe
Caption = "Anagrafe"
Connect = "Access"
DatabaseName = "F:\database\amici2.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 495
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "anagrafe"
Top = 120
Width = 4455
End
Begin VB.Line Line1
X1 = 5520
X2 = 5520
Y1 = 0
Y2 = 5160
End
Begin VB.Label Lbl_telefono
Caption = "Telefono"
Height = 375
Left = 240
TabIndex = 9
Top = 3240
Width = 1935
End
Begin VB.Label Lbl_id
Caption = "ID"
Height = 375
Left = 240
TabIndex = 8
Top = 3960
Width = 1935
End
Begin VB.Label Lbl_eta
Caption = "Età"
Height = 375
Left = 240
TabIndex = 7
Top = 2520
Width = 1935
End
Begin VB.Label Lbl_nome
Caption = "Nome"
Height = 495
Left = 240
TabIndex = 6
Top = 1680
Width = 1935
End
Begin VB.Label lbl_cognome
Caption = "Cognome"
Height = 375
Left = 240
TabIndex = 0
Top = 960
Width = 1935
End
End
Attribute VB_Name = "Txt_id"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conf As Integer
Private Sub Cmd_cancella_Click()
If dt_anagrafe.Recordset.BOF = True Or dt_anagrafe.Recordset.EOF = True Then
MsgBox ("fine file")
'dt_anagrafe.Recordset.MoveFirst
Else
conf = MsgBox("sei sicuro?", vbYesNo)
If conf = 6 Then
dt_anagrafe.Recordset.Delete
dt_anagrafe.Recordset.MoveNext
Else
End If
End If
Cmd_nuovo.Enabled = True
Cmd_cancella.Enabled = True
End Sub
Private Sub Cmd_Conferma_Click()
Cmd_Conferma.Enabled = False
Cmd_nuovo.Enabled = True
Cmd_cancella.Enabled = True
dt_anagrafe.Recordset.Update
dt_anagrafe.Recordset.MoveLast
End Sub
Private Sub Cmd_nuovo_Click()
Cmd_Conferma.Enabled = True
Cmd_nuovo.Enabled = False
dt_anagrafe.Recordset.AddNew
txt_cognome.SetFocus
End Sub
Private Sub Cmd_trova_Click()
Dim cognomeinput As String
cognomeinput = InputBox("inserisci il cognome delle persono che vuoi ricercare", "inserisci...")
dt_anagrafe.RecordSource = "SELECT * FROM anagrafe WHERE anagrafe.cognome = '" & cognomeinput & "'"
dt_anagrafe.Refresh
End Sub
Private Sub Cmd_tutti_Click()
dt_anagrafe.RecordSource = "SELECT * FROM anagrafe"
dt_anagrafe.Refresh
End Sub