FreonIceMan
Registered User.
- Local time
- Today, 13:26
- Joined
- May 31, 2011
- Messages
- 19
I have a report that I run which has PT_Ins_ID in it, I am trying to edit that row with the following code. I have been searching how to do this and I haven't had any luck. If I am doing something wrong or if someone know of a way to do this with vba it would be appreciated.
Thanks,
Freon
:banghead:
PT_Ins_ID is the primary key of dbo_Patient_Insurance
I've also tried this.
Thanks,
Freon
:banghead:
PT_Ins_ID is the primary key of dbo_Patient_Insurance
Code:
Private Sub cmd_Deact_Click()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("dbo_Patient_Insurance")
If rs.RecordCount <> 0 Then
With rs
.FindFirst "PT_Ins_ID" = Me.txt_PT_Ins_ID
If Not .NoMatch Then
.Edit
.Fields("PT_Ins_Active").Value = 0
.Fields("PT_Ins_Inactive_Date") = Now()
.Fields("PT_Ins_Deactivating_User") = (Environ$("Username"))
.Update
End If
End With
End If
End Sub
I've also tried this.
Code:
Dim rs_PI As DAO.Recordset
Set rs_PI = CurrentDb.OpenRecordset("dbo_Patient_Insurance")
DoWhile ("PT_Ins_ID") <> Me.txt_PT_Ins_ID
rs_PI.MoveNext
Loop
rs_PI.Edit
rs_PI("PT_Ins_Active").Value = 0
rs_PI("PT_Ins_Inactive_Date") = Now()
rs_PI("PT_Ins_Deactivating_User") = (Environ$("Username"))
rs_PI.Update