Hey all,
Im trying to include the following code in a _Onclick event
The event is for Form that includes information that should be updated in another table whenever there is an update/change. Not sure if the .Execute is the best way to do this...I was trying to use a rs.update but that does not do ALL the records with the matching ID (See below). Any advice or suggestions for best doing this would be appreciated! Thank you.
Im trying to include the following code in a _Onclick event
SQL:
CurrentDb.Execute ("UPDATE Client SET Client.CaseMgrFax = " & Me.Fax_Number & " WHERE Client.CCID = '" & Me.ID & "'")
The event is for Form that includes information that should be updated in another table whenever there is an update/change. Not sure if the .Execute is the best way to do this...I was trying to use a rs.update but that does not do ALL the records with the matching ID (See below). Any advice or suggestions for best doing this would be appreciated! Thank you.
SQL:
DoCmd.SetWarnings False
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Client")
rs.FindFirst ("CCID = " & Me.ID)
If Not rs.NoMatch Then
rs.Edit
rs.[CaseManager] = Me.Case_Coordinator
rs.[CCID] = Me.ID
rs.[ServiceArea] = Me.Region
rs.[CMPhone] = Me.Phone_Number
rs.[CaseMgrFax] = Me.Fax_Number
rs.[CaseCoordEmail] = Me.Email
rs.Update
rs.Close
End If
Set rs = Nothing
DoCmd.SetWarnings True