I'm new to Access VBA development and being asked to debug and add features to an Access 2007 application that two previous developers worked on.
A form displays records from a database and shows a button for each record. The button is supposed to open a file using the appropriate path. But when the user clicks the button, it always uses the filepath from the first record that the form displays, instead of the filepath from the correct record.
The code looks like it is trying to use a bookmark to open the correct file, but as stated above, that isn't working. Here is the relevant code from the button click event. When I try to Debug.Print form.Bookmark to the immediate window, it just displays a question mark.
Dim rs As Recordset
Set rs = form.RecordsetClone
rs.Bookmark = form.Bookmark
Edit: adding more code per @Remou's request. When button is clicked:
Private Sub OpenFile_Click()
Form_FilingProcess.Subform_cmdOpenFile_Click Me
End Sub
Which calls:
Public Sub Subform_cmdOpenFile_Click(frm As Form)
Set rs = frm.RecordsetClone
rs.Bookmark = frm.Bookmark
And then it goes on to open the file.