Kod:
If MsgBox("Do you want to change record ?", vbYesNo + vbQuestion + vbDefaultButton1, " W A R N I N G") = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunMacro "MCR_Resp_Update"
Me.Kayıtlı.Value = True
Me.Lsst_Update_Date.Value = Now()
Me.Text54.Value = Username()
Me.Combo58.Requery
DoCmd.SetWarnings False
Else
SendKeys "{ESC}"
End If
ancak then bloğunun sonunda true ile tekrar açmanız gerekiyordu, atlamış ve tekrar false yaptırmışsınız.
* DoCmd.RunMacro "MCR_Resp_Update"
komutu ile "QRY_Responsible_Update" adlı güncelleme sorgusunu çalıştırıp arkasından formu requery ile güncelliyorsunuz.
Ama burada atladığınız şu, siz henüz üzerinde olduğunuz mevcut kaydı kaydetmediniz.
Combo ile bir alanda değişiklik yaptığınız için mevcut kayıt güncelleme pozisyonunda kaldı.
Kod:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
* Devamında mevcut kayıtta kod ile yine değişiklik yapıyorsunuz.
Kod:
Me.Kayıtlı.Value = True
Me.Lsst_Update_Date.Value = Now()
Me.Text54.Value = Username()
Kod:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
* Me.Combo58.Requery
comboyu güncellemişsiniz ancak bunu niye yaptığınızı anlamadım.
combonun verilerinde değişiklik yoksa, güncellemeye de gerek yok.
Bu şekilde mevcut kaydı 2 defa üst üste kaydetmiş oldunuz tabloya.
Eğer işlemlerin yerlerini değiştirirseniz bir defa kaydederek çözebilirsiniz.
Yani önce update ile ilgili yaptığınız değişiklikleri atayıp, kaydedin.
Sonra güncelleme sorgusunu çalıştırın.
Kod:
If MsgBox("Do you want to change record ?", vbYesNo + vbQuestion + vbDefaultButton1, " W A R N I N G") = vbYes Then
Me.Kayıtlı.Value = True
Me.Lsst_Update_Date.Value = Now()
Me.Text54.Value = Username()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.SetWarnings False
DoCmd.RunMacro "MCR_Resp_Update"
DoCmd.SetWarnings True
Else
SendKeys "{ESC}"
End If