List Item Edit Form

Rmaster2022

Member
Local time
Yesterday, 18:15
Joined
Apr 1, 2022
Messages
32
I have a navigation form, “frmMain.” One form in the navigation form is “frmPastorViewEdit,” which I understand is a subform of frmMain. In the subform is a combo box “cmbEccBody” The bound column is “PresbyID”

The combo box has in its List Item Edit Form property “frmPresytery” where one can add a value.

I want to write vba code that would automatically add the value to the combo box that was added in the “frmPresbytery,” so that I don’t have to scroll through the list to find it.

I tried the following: [Forms]![frmMain]![frmPastorViewEdit].[Form]![cmbEccBody] = PresbyID

I tried it with and without brackets, and some variations, but it won’t work. Still very much a beginner in vba!
 
Hi. If you're going the VBA route, you might as well consider using the Not In List event rather than the List Item Edit Form. Just a thought...
 
add code to AfterUpdate Event of your Form, “frmPresytery”:

Code:
Privat Sub Form_AfterUpdate()
Dim ctl As ComboBox
Forms!frmMain.SetFocus
Forms!frmMain!NavigationSubform.SetFocus
Forms!frmMain!NavigationSubform!cmbEccBody.SetFocus
Set ctl = Screen.ActiveControl
ctl = Me.PresByID
End Sub
 
Last edited:
When I run the code I get an run error 13, type mismatch on this line:

Set ctl = Screen.ActiveControl

However, if I continue through the code, it ends up doing exactly what I want it to do!
 

Users who are viewing this thread

Back
Top Bottom