A
AA
Hello All,
i need advice on how to update excisting contact info on form and save it
with my little experance in access programming i'm having trouble,
here is the form code (was done by a different IT person)
Option Compare Database
Private Sub Find_Click()
End Sub
Private Sub Last_Name_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Last_Name_GotFocus()
End Sub
Private Sub Last_Name_NotInList(NewData As String, Response As Integer)
End Sub
Private Sub Buiilding_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub cboContact_AfterUpdate()
Dim ContactID As String
Dim rst As DAO.Recordset
ContactID = "SELECT * FROM Contacts " & " WHERE ContactName = '" _
& Me!cboContact.Value & "'"
Set rst = CurrentDb.OpenRecordset(ContactID, dbOpenDynaset)
If rst.EOF = True And rst.BOF = True Then
Call MsgBox("The Contact Name you entered does not exist")
Else
Me!Telephone = rst!Telephone
Me!TbxFax = rst!Fax
Me!TbxComp = rst!Company
Me!TbxFloor = rst!Floor
Me!TbxStreet = rst!Street
Me!TbxCityStateZip = rst!CityStateZip
Me!TbxEmail = rst!email
Me!TbxAcctMgr = rst!Manager
End If
Set rst = Nothing
End Sub
Private Sub Close_Click()
DoCmd.Close
End Sub
Private Sub Form_Load()
'Set Record Source for Forms as Contacts Table
Forms!Contacts.RecordSource = "Contacts"
End Sub
Private Sub Product_Department_AfterUpdate()
End Sub
Private Sub Product_Department_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Product_Department_Exit(Cancel As Integer)
End Sub
i'm trying to use this statement
not sure if its correct
please advice
Private Sub Update_Contact_Click()
Dim QrySQL As String
QrySQL = "INSERT INTO [Contacts] ( Company, Street, Floor, CityStateZip,
Telephone, Fax, Manager, Email)"
DoCmd.SetWarnings False
DoCmd.RunSQL QrySQL
DoCmd.SetWarnings True
MsgBox "Update Was Completed"
End Sub
i need advice on how to update excisting contact info on form and save it
with my little experance in access programming i'm having trouble,
here is the form code (was done by a different IT person)
Option Compare Database
Private Sub Find_Click()
End Sub
Private Sub Last_Name_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Last_Name_GotFocus()
End Sub
Private Sub Last_Name_NotInList(NewData As String, Response As Integer)
End Sub
Private Sub Buiilding_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub cboContact_AfterUpdate()
Dim ContactID As String
Dim rst As DAO.Recordset
ContactID = "SELECT * FROM Contacts " & " WHERE ContactName = '" _
& Me!cboContact.Value & "'"
Set rst = CurrentDb.OpenRecordset(ContactID, dbOpenDynaset)
If rst.EOF = True And rst.BOF = True Then
Call MsgBox("The Contact Name you entered does not exist")
Else
Me!Telephone = rst!Telephone
Me!TbxFax = rst!Fax
Me!TbxComp = rst!Company
Me!TbxFloor = rst!Floor
Me!TbxStreet = rst!Street
Me!TbxCityStateZip = rst!CityStateZip
Me!TbxEmail = rst!email
Me!TbxAcctMgr = rst!Manager
End If
Set rst = Nothing
End Sub
Private Sub Close_Click()
DoCmd.Close
End Sub
Private Sub Form_Load()
'Set Record Source for Forms as Contacts Table
Forms!Contacts.RecordSource = "Contacts"
End Sub
Private Sub Product_Department_AfterUpdate()
End Sub
Private Sub Product_Department_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Product_Department_Exit(Cancel As Integer)
End Sub
i'm trying to use this statement
not sure if its correct
please advice
Private Sub Update_Contact_Click()
Dim QrySQL As String
QrySQL = "INSERT INTO [Contacts] ( Company, Street, Floor, CityStateZip,
Telephone, Fax, Manager, Email)"
DoCmd.SetWarnings False
DoCmd.RunSQL QrySQL
DoCmd.SetWarnings True
MsgBox "Update Was Completed"
End Sub