Hi all
I've a mask with some fields that rappresents a table.
I put a button with this VBA code:
Private Sub Command21_Click()
Dim rstPersone As DAO.Recordset
Dim dbinterventi As Object
Set dbinterventi = CurrentDb
Set rstPersone = dbinterventi.OpenRecordset("tab_Persone")
rstPersone.AddNew
rstPersone!Azienda = Azienda
If Azienda = True Then
rstPersone!Nome_azienda = Nome_azienda
Else
rstPersone!Nome = Nome
rstPersone!Cognome = Cognome
End If
rstPersone!Luogo = Luogo
rstPersone!Via = Via
rstPersone!Telefono = Telefono
rstPersone!Natel = Natel
rstPersone!Email = Email
rstPersone!Note = Note
rstPersone.Update
rstPersone.Close
Set rstPersone = Nothing
End Sub
Now, when I click this button, the current record is saved, but when I close my form (mask) or I change record or I add another one, access saves another record (THAT IS THE SAME OF THE ONE SAVED BEFORE) but with another ID.
I hope u understand.
Any suggestions?
Thanks
I've a mask with some fields that rappresents a table.
I put a button with this VBA code:
Private Sub Command21_Click()
Dim rstPersone As DAO.Recordset
Dim dbinterventi As Object
Set dbinterventi = CurrentDb
Set rstPersone = dbinterventi.OpenRecordset("tab_Persone")
rstPersone.AddNew
rstPersone!Azienda = Azienda
If Azienda = True Then
rstPersone!Nome_azienda = Nome_azienda
Else
rstPersone!Nome = Nome
rstPersone!Cognome = Cognome
End If
rstPersone!Luogo = Luogo
rstPersone!Via = Via
rstPersone!Telefono = Telefono
rstPersone!Natel = Natel
rstPersone!Email = Email
rstPersone!Note = Note
rstPersone.Update
rstPersone.Close
Set rstPersone = Nothing
End Sub
Now, when I click this button, the current record is saved, but when I close my form (mask) or I change record or I add another one, access saves another record (THAT IS THE SAME OF THE ONE SAVED BEFORE) but with another ID.
I hope u understand.
Any suggestions?
Thanks