NavigationSubforms (Navigate To and Select RecordSource)

Bluecider

New Member
Joined
Feb 11, 2017
Messages
12
I just wanted to share my adventures about Navigation Subform controls and manipulations.

In my current design, I have a MAIN form, and within that form is embedded a NavigationSubform control.

There are two different NavigationSubform items in this example.

#1) The first one is presented as a datasheet within the NavigationSubform

#2) The second one is presented as a form within the NavigationSubform.

Objective is to allow the selected record in #1 above (based on dblclick by the user on the record row), be shown
as the record after calling the form from #2.

This is not the most elegant way to do this I'm sure, so please be kind with your alternative suggestions.


STARTING FROM #1 Datasheet view above
Code:
Sub Form_DblClick(Cancel As Integer)

Dim REC As Integer  'Defines variable to capture record number selected


REC = Me.JOB_ID  'Stores selected record number

'Calls into NavigationSubform control the JobEntry FORM
Forms![frm_MAIN].NavigationSubform.SourceObject = "frm_JOBENTRY"  

'Sets the record to display in this form as the record which was selected when initiating the dblclick
Forms![frm_MAIN].NavigationSubform.Form.RecordSource = "SELECT DISTINCTROW tbl_JOBS.* FROM tbl_JOBS WHERE (tbl_JOBS.JOB_ID = " & REC & ");"

End Sub

I hope this helps people looking to do something similar, as I had to rack my head around how to handle especially the second part.
 
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,221,713
Messages
6,161,459
Members
451,708
Latest member
PedroMoss2268

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top