List Item Edit Form (1 Viewer)

Rmaster2022

Member
Local time
Today, 04:54
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!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:54
Joined
Oct 29, 2018
Messages
21,358
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...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:54
Joined
May 7, 2009
Messages
19,175
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:

Rmaster2022

Member
Local time
Today, 04:54
Joined
Apr 1, 2022
Messages
32
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

Top Bottom