Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a Spreadsheet for Staff to record their Voice Messages &
Followups. They use UserForms to input the initial data, which could be from either of two sources Employers or Claimant. Once they have the record on the spreadsheet they can update that record, with additional data and then Update that record to a Database(elsewhere). My problem now is if they get a call from the employer and post the record, which uses the Claimants SSN as the search criteria to Update the Recod on the Database; THEN a Claimant calls in and we attempt to create a new record. Since the SSN are the same the database attempts to update the original record instead of adding a destict record (one for the Employer and one for the Claimant). Here is a protion of the Code: LG = Range("F" & 1).Value Qry = "LOG" & LG ' sets the Query R = ActiveCell.Row "This row has the data to be Added or Updated FDate = Range("C" & R).Value ' Initial Date of Call FSSN = Range("F" & R).Value ' The Claimants SSN FFrom = Range("E" & R).Value ' Call from one of two (Employer or Claimant) adjlog = "\\fld035728\Team\AdjLog.mdb" Set dbs = OpenDatabase(adjlog) Set qd = dbs.CreateQueryDef(Qry) qd.SQL = "SELECT * FROM TEntry " _ & "WHERE Login='" & LG & "';" Set rs = dbs.OpenRecordset(Qry) notfound = False rs.MoveFirst Do If FSSN = rs.Fields("SSN") Then notfound = True rs.Edit rs.Fields("Complete") = Range("A" & R).Value rs.Fields("Login") = Range("F" & 1).Value rs.Fields("From") = Range("E" & R).Value rs.Fields("Date") = Range("C" & R).Value rs.Fields("Time") = Range("D" & R).Value rs.Fields("SSN") = Range("F" & R).Value ...... etc. Note: if the record is not found then it moves the rs. Add function, etc. I want the If statment to be like: If FSSN = rs.Fields("SSN") AND FDate = rs.("Date")AND _ FFrom = rs.("From")Then But, this fails. and it ADDs a new record everytime. The If statement with one item works as is listed above in the code, but I need to add items to narrow the search? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
password failure | Excel Worksheet Functions | |||
vlookup failure & ctrl-f failure? | Excel Discussion (Misc queries) | |||
failure of web query | Excel Discussion (Misc queries) | |||
sumproduct failure? | Excel Discussion (Misc queries) | |||
Catastrophic failure HELP!! | Excel Programming |