Subform with VBA in Navigation form

adple

New member
Local time
Today, 12:19
Joined
Mar 21, 2018
Messages
2
Hello everyone.
Im pretty newby in access and VBA. Two weeks ago i started create some base to collect data in lab.

But now im stuck in navigation form.

I have form called fmLabTest with continuous subform fmLabNagList that lists all the records of the fmLabTest record source.
I added a VBA code in the fmLabNagList to execute GoToRecord, showing the same record number in fmLabTest

Code:
Private Sub Form_Click()
Dim Reco As Integer
Reco = CurrentRecord
DoCmd.GoToRecord acDataForm, "fmLabTest", acGoTo, Reco
End Sub
It works, but when puted fmLabTest into navigation form navLab then problem started.
I tryed some examples from net but i can't figure how solve this problem:confused:.
 
Last edited:
Istead of using vba you can add Master/child link. On design view click on the subform. Make sure a boundary line is shown surrounding the sub. On its property window -> data, set the master to the field name if your mainform (pk) abd set the child link to the field on your subform (fk).
 
Istead of using vba you can add Master/child link. On design view click on the subform. Make sure a boundary line is shown surrounding the sub. On its property window -> data, set the master to the field name if your mainform (pk) abd set the child link to the field on your subform (fk).

If i do like you wrote i see only one position on my subform fmLabNagList
 
so you only want to jump to that record in the subform.

private sub form_click()
dim rs as dao.recordset
set rs = me.frmLabTest.Form.Recordsetclone
rs.findfirst "id=" & me.id
if not rs.nomatch then _
me.frmLabTest.Form.Bookmark = rs.Bookmark
set rs=nothing
end sub
 

Users who are viewing this thread

Back
Top Bottom