I’ve been trying to do what I thought was a simple task. I'm tracking several documents with my data base. Each document is given a unique name and that field is the primary field. Here is the code from the main form.
Sending code from a label in main form
'<<<<XXX>>>> Row 8b
Private Sub BD_stuff_Click()
On Error GoTo Err_BD_stuff_Click
Dim Pstring As Variant
Dim stDocName As String
Dim stLinkCriteria As String
Pstring = CurrentRecord
stDocName = "RFIsBD_stuff"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_BD_stuff_Click:
Exit Sub
Err_BD_stuff_Click:
MsgBox Err.Description
Resume Exit_BD_stuff_Click
End Sub
This is the subform code
Note I have a series of buttons to navigate between records, this code establishes and sets up the buttons [first, previous, next, last, new, duplicate]
Receiving code of subform
'<<<<XXX>>>> On opening
Private Sub Form_Current()
On Error GoTo Err_Form_Current
Dim rs As DAO.Recordset
Dim Count As Integer, Position As Integer
Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst
Count = rs.RecordCount
Me!txtRecCnt = "of " & Count
Position = Me.CurrentRecord
Me!txtRecPos = Position
If Position = 1 Then
Me!gotoPrevious.Enabled = False
Else
Me!gotoPrevious.Enabled = True
End If
If Position > Count Then
Me!gotoNext.Enabled = False
Me!gotoNew.Enabled = False
End Sub