I have a form/table which I want to use the value of a textbox to find a record in another table and then edit that record (the value is an autonumber in that other table). Have tried a variety of ways. This current code gives me run time error 2162 on the findrecord line.
Dim UCID As Variant
UCID = Forms![Council Workflow Form].[Unique Council ID].Value
Forms![Council Workflow Form].[Unique Council ID].SetFocus
Dim rsToCouncilTable As Object 'to send response to council table
Set rsToCouncilTable = CurrentDb.OpenRecordset("Council Table")
rsToCouncilTable.Edit
DoCmd.FindRecord UCID, , , , , , True
rsToCouncilTable![Unique order id] = [Unique order id]
rsToCouncilTable![Unique Patient ID] = [Unique Patient ID]
rsToCouncilTable.Fields(Forms![Council Workflow Form].[Linked Control]) = [Resp Answer]
rsToCouncilTable.Update
rsToCouncilTable.Close
Dim UCID As Variant
UCID = Forms![Council Workflow Form].[Unique Council ID].Value
Forms![Council Workflow Form].[Unique Council ID].SetFocus
Dim rsToCouncilTable As Object 'to send response to council table
Set rsToCouncilTable = CurrentDb.OpenRecordset("Council Table")
rsToCouncilTable.Edit
DoCmd.FindRecord UCID, , , , , , True
rsToCouncilTable![Unique order id] = [Unique order id]
rsToCouncilTable![Unique Patient ID] = [Unique Patient ID]
rsToCouncilTable.Fields(Forms![Council Workflow Form].[Linked Control]) = [Resp Answer]
rsToCouncilTable.Update
rsToCouncilTable.Close