update existing record

ranen

pinoy 'to
Local time
Today, 00:50
Joined
Jun 14, 2005
Messages
29
I don't know how to explain my problem.

my problem is if a record exist and want to update it using code. how can I filter that record and update it. my code updates the table but it updates the first record. so how can i go to that record and update it.

i do have an error "syntax error FROM clause" how can i prevent this?

thank you so much:confused:
 
is this code possible

I do have this code where I have to filter or look for the name and phone number of the person because when I am saving this record the one edited was the first record not the record with this previous information.

Does my story make any sense?

Please help me...I cannot find the right way to do this..please:(
With rs
strsql = "SELECT * FROM tblCustomers WHERE [FName]='" & Forms!frmServiceFormDataRecovery!FName & "' AND [LName]= '" & Forms!frmServiceFormDataRecovery!LName & "' AND [Phoneno1] = '" & Forms!frmServiceFormDataRecovery!PhoneNo1 & "'"
.Open strsql, conn, adOpenDynamic, adLockOptimistic, adCmdTable
.Fields("CustomerID") = Nz(Me.CustomerID, "")
.Fields("CompanyName") = Nz(Me.CompanyName, "")
.Fields("Title") = Nz(Me.Title, "")
.Fields("Fname") = Nz(Me.FName, "")
.Fields("Lname") = Nz(Me.LName, "")
.Fields("Address") = Nz(Me.Address, "")
.Fields("City") = Nz(Me.City, "")
.Fields("Stateprovince") = Nz(Me.StateProvince, "")
.Fields("PostalCode") = Nz(Me.PostalCode, "")
.Fields("EmailAdd") = Nz(Me.EmailAdd, "")
.Fields("PhoneNo1") = Nz(Me.PhoneNo1, "")
.Fields("PhoneNo2") = Nz(Me.PhoneNo2, "")
.Fields("CelNo") = Nz(Me.CelNo, "")
.Fields("FaxNo") = Nz(Me.FaxNo, "")
.Update
.Close
'End If
End With
 

Users who are viewing this thread

Back
Top Bottom