There's a problem with the way you're using getnextidwithprefix. It's a function that returns a value, but you're using a Call statement to call it, and internally it's setting Forms![Fm_Risk_Ass]!Text83. You should delete this line from the function:
Forms![Fm_Risk_Ass]!Text83 = Prefix & Format(rst!Lastid, "0000"

and change the Call statement to:
Forms![Fm_Risk_Ass]!Text83 = getnextidwithprefix([Forms]![Fm_Risk_Ass]![Cb_Cat])
I need you to do this so that the code for the Copy button can get an ra_no without the function trying to store it in the form. (If you call getnextidwithprefix from anywhere else in your code, you need to make the change in those places as well.)
Private Sub Command241_Click()
Dim NewRA_no As String
Dim rst As DAO.Recordset
' Save the current record if necessary. Exit if canceled
If Me.Dirty Then
On Error GoTo ErrorExit
RunCommand acCmdSaveRecord
On Error GoTo 0
End If
' Get an ra_no to use with the duplicate record
' TODO: Change the category field if necessary
NewRA_no = getnextidwithprefix(category)
' Duplicate the Q_RA_Browsecriteria record, replacing the ra_no with the new one
DoCmd.RunSQL "INSERT INTO Q_RA_Browsecriteria " _
& "(ra_no, project_no, category, location, sublocation, subcategory, consequence) " _
& "SELECT '" & NewRA_no & "', project_no, category, location, sublocation, subcategory, consequence " _
& "FROM Q_RA_Browsecriteria " _
& "WHERE Ra_No = '" & ra_no & "'"
' Duplicate the Tb_options records, replacing the ra_no with the new one
DoCmd.RunSQL "INSERT INTO Tb_options " _
& "(ra_no, Op_Consequence, OP_Likelihood, cost, uniqueid) " _
& "SELECT '" & NewRA_no & "', Op_Consequence, OP_Likelihood, cost, uniqueid " _
& "FROM Tb_options " _
& "WHERE ra_no = '" & ra_no & "'"
' Position the form to the new record
Set rst = Me.RecordsetClone()
rst.FindFirst "ra_no = '" & NewRA_no & "'"
If rst.NoMatch Then
MsgBox "Programming error - couldn't position to new record", vbCritical
Else
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
ErrorExit:
End Sub
Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein