Sub RunSQL(strSQL As String)
'turn off the warnings
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
'DoCmd.Requery
'turn warnings on
DoCmd.SetWarnings True
End Sub
Private Sub Save_Button_Click()
Dim lngWorkerID As Long
Dim strSQL As String
If lngWorkerID <> 0 Then
RunSQL "UPDATE tblCallTree SET " & _
"FirstName = """ & Me.FirstName & """," & _
"LastName = """ & Me.LastName & """," & _
"HomePhone = """ & Me.HomePhone & """," & _
"CellPhone = """ & Me.CellPhone & """," & _
"Pager = """ & Me.Pager & """," & _
"Extension = """ & Me.Extension & """," & _
"Email = """ & Me.Email & """," & _
"Fax = """ & Me.Fax & """," & _
"ManagerID = " & Me.Manager & "," & _
"IsManager = " & Me.IsManager & "," & _
"[Updated?] = Date() " & _
"WHERE WorkerID = " & lngWorkerID
Else
RunSQL "INSERT INTO tblCallTree (FirstName, LastName, HomePhone, CellPhone, Pager, Extension, Email, Fax, ManagerID, IsManager, CampaignID, [Updated?]) VALUES ( " & _
"""" & Me.FirstName & """," & _
"""" & Me.LastName & """," & _
"""" & Me.HomePhone & """," & _
"""" & Me.CellPhone & """," & _
"""" & Me.Pager & """," & _
"""" & Me.Extension & """," & _
"""" & Me.Email & """," & _
"""" & Me.Fax & """," & _
Me.Manager & "," & _
Me.IsManager & "," & _
Me.CampaignID & "," & _
Date & ")"
End If
DoCmd.Close acForm, "frmEditContact_LiveCallTree", acSaveYes
[Forms]![frmLiveCallTree]![Contacts_List].Requery
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE