Your Form's code requires a Form object (Me) to work. All you need to do is reference it from the module. The rest stays the same.
In your form, modify your code like this:
Code:
Private Sub btn01DiaryScript_Click()
openRecDryForm Me
End Sub
In the module, add that sub like this:
Code:
Sub openRecDryForm(frm As Form)
If frm.NewRecord Then
Exit Sub
Else
DoCmd.OpenForm "F1RecordingsDiary", , , , , , frm.txtIDcu
End If
frm.Dirty = False
End Sub
As is, it should work. However, thinking in "modules", we are hardcoding the form that this sub will open and we are also hardcoding the openargs. A better subroutine would take those parameters, like this:
Code:
Sub customFormOpener(originForm As Form, targetFormName as string, formOpenArgs as string)
If originForm.NewRecord Then
Exit Sub
Else
DoCmd.OpenForm targetFormName, , , , , , formOpenArgs
End If
originForm.Dirty = False
End Sub
And then call like this:
Code:
Private Sub btn01DiaryScript_Click()
customFormOpener Me, "F1RecordingsDiary", Me.txtIDcu
End Sub
With this approach, you should be able to reuse this code more easily. And we could go even further.