I have a button on a popup form that when clicked runs a code to duplicate the current record that I am viewing on my main form. It first asks me to enter a new number (primary key) into a pop-up box and then duplicates the record replacing the primary key with the new number. I use this in cases where the next record only requires a few field changes, so I don’t have to retype the hold record. The problem is that when the code runs to do this, it ends by filtering to the duplicated record. I would like it to go to that record without filtering out all the other records. That way I can move back a couple of records if I need to without un-filtering and then re-finding that record. The code at the end that filters to the new record is:
- DoCmd.OpenForm "frmDescription", acNormal, , "[Accession Number]='" + MyValue + "'"
MyValue is the new record number.
I did not write this code and I do not understand code very well but am slowly learning.
I think that I need to replace it with a Findfirst code but am not sure?
I have been working with this code but have had no luck…
- DoCmd.Close acForm, "frmDescription"
-
DoCmd.OpenForm "frmDescription"
-
-
Dim rst As Recordset
-
Dim strSearchName As String
-
Set rst = Me.RecordsetClone
-
strSearchName = Str([Accession Number] = MyValue)
-
rst.FindFirst "Accession Number = " & strSearchName
-
Me.Bookmark = rst.Bookmark
Can anyone one help?