Ciao questo è il codice che ho io
Private Sub CmdAnnulla_Click()
Data1.Recordset.CancelUpdate
CmdSalva.Visible = False
CmdPrima.Enabled = True
CmdUltima.Enabled = True
CmdAvanti.Enabled = True
CmdIndietro.Enabled = True
CmdAnnulla.Visible = False
CmdModifica.Visible = True
CmdNuova.Visible = True
CmdStampa.Enabled = True
End Sub
Private Sub CmdAvanti_Click()
Data1.Recordset.MoveNext
If Data1.Recordset.BOF = True Then
Data1.Recordset.MoveNext
ElseIf Data1.Recordset.EOF = True Then
Data1.Recordset.MovePrevious
End If
End Sub
Private Sub CmdChiudi_Click()
'Esce dal programma.
Unload Me
End Sub
Private Sub CmdIndietro_Click()
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF = True Then
Data1.Recordset.MoveNext
ElseIf Data1.Recordset.EOF = True Then
Data1.Recordset.MovePrevious
End If
End Sub
Private Sub CmdModifica_Click()
Data1.Recordset.Edit
CmdSalva.Visible = True
CmdAnnulla.Visible = True
CmdPrima.Enabled = False
CmdUltima.Enabled = False
CmdAvanti.Enabled = False
CmdIndietro.Enabled = False
CmdNuova.Visible = False
CmdStampa.Enabled = False
End Sub
Private Sub CmdNuova_Click()
Data1.Recordset.AddNew
CmdPrima.Enabled = False
CmdUltima.Enabled = False
CmdAvanti.Enabled = False
CmdIndietro.Enabled = False
CmdSalva.Visible = True
CmdAnnulla.Visible = True
CmdModifica.Visible = False
CmdStampa.Enabled = False
End Sub
Private Sub CmdPrima_Click()
Data1.Recordset.MoveFirst
End Sub
Private Sub CmdSalva_Click()
Data1.Recordset.Update
CmdPrima.Enabled = True
CmdUltima.Enabled = True
CmdAvanti.Enabled = True
CmdIndietro.Enabled = True
CmdSalva.Visible = False
CmdAnnulla.Visible = False
CmdModifica.Visible = True
CmdNuova.Visible = True
CmdStampa.Enabled = True
End Sub
Private Sub CmdStampa_Click()
Archivio.PrintForm
End Sub
Private Sub CmdUltima_Click()
Data1.Recordset.MoveLast
End Sub
Private Sub Data1_Validate(Action As Integer, Save As Integer)
Dim risposta As Integer
If Save = True Then
risposta = MsgBox("Salvare Nuova Estrazione?", vbQuestion + vbYesNo, Me.Caption)
If risposta = vbNo Then
Text1(Index).DataChanged = False
Textdata(Index).DataChanged = False
textrecord.DataChanged = False
Textposizione.DataChanged = False
End If
End If
End Sub
Private Sub Textdata_GotFocus(Index As Integer)
Textdata(Index).BackColor = vbYellow
End Sub
Private Sub Textdata_LostFocus(Index As Integer)
Textdata(Index).BackColor = vbWhite
End Sub
Private Sub Textposizione_GotFocus()
Textposizione.BackColor = vbYellow
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = vbYellow
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = vbWhite
End Sub
Private Sub Textposizione_LostFocus()
Textposizione.BackColor = vbWhite
End Sub
Private Sub textrecord_GotFocus()
textrecord.BackColor = vbYellow
End Sub
Private Sub textrecord_LostFocus()
textrecord.BackColor = vbWhite
End Sub
ho problemi anche per il controllo della DATA1
quando visualizzo le estrazioni i textbox sono modificabili
quindi vorrei bloccarli quando visualizzo e sbloccarli quando inserisco una nuova o modifica
Alarico_Re