I created a combo box based on a table, Depending on which record is selected I want a specific formto open.
trawling the web I created a module as below - I added a button to the form and in the onclick event selected code builder and typed the code-
When I run it I get the errorCode:Private Sub Search_Click() Dim strParish As String If Me.Select_Parish = "Axbridge" Then strParish = "frm_Axbridge" ElseIf Me.Select_Parish = "Backwell" Then strParish = "frm_Backwell" ElseIf Me.Select_Parish = "Badgworth" Then strParish = "frm_Badgworth" ElseIf Me.Select_Parish = "Banwell" Then strParish = "frm_Banwell" ElseIf Me.Select_Parish = "Barrow Gurney" Then strParish = "frm_BarrowGurney" ElseIf Me.Select_Parish = "Berrow" Then strParish = "frm_Berrow" ElseIf Me.Select_Parish = "Biddisham" Then strParish = "frm_biddisham" ElseIf Me.Select_Parish = "Blagdon" Then strParish = "frm_Blagdon" ElseIf Me.Select_Parish = "Bleadon" Then strParish = "frm_Bleadon" ElseIf Me.Select_Parish = "Brean" Then strParish = "frm_Brean" ElseIf Me.Select_Parish = "Brockley" Then strParish = "frm_Brockley" ElseIf Me.Select_Parish = "Burnham-on-Sea" Then strParish = "frm_BurnhamOnSea" ElseIf Me.Select_Parish = "Burrington" Then strParish = "frm_Burrington" ElseIf Me.Select_Parish = "Butcombe" Then strParish = "frm_Butcombe" ElseIf Me.Select_Parish = "Chapel Allerton" Then strParish = "frm_ChapelAllerton" ElseIf Me.Select_Parish = "Cheddar" Then strParish = "frm_Cheddar" ElseIf Me.Select_Parish = "Chelvey" Then strParish = "frm_Chelvey" ElseIf Me.Select_Parish = "Chew Magna" Then strParish = "frm_ChewMagna" ElseIf Me.Select_Parish = "Chew Stoke" Then strParish = "frm_ChewStoke" ElseIf Me.Select_Parish = "Christon" Then strParish = "frm_Cheriston" ElseIf Me.Select_Parish = "Churchill" Then strParish = "frm_Churchill" ElseIf Me.Select_Parish = "Clapton in Gordano" Then strParish = "frm_ClaptoninGordano" ElseIf Me.Select_Parish = "Cleeve" Then strParish = "frm_cleeve" ElseIf Me.Select_Parish = "Clevedon" Then strParish = "frm_Clevedon" ElseIf Me.Select_Parish = "Clutton" Then strParish = "frm_Clutton" ElseIf Me.Select_Parish = "Compton Bishop" Then strParish = "frm_ComptonBishop" ElseIf Me.Select_Parish = "Compton Martin" Then strParish = "frm_ComptonMartin" ElseIf Me.Select_Parish = "Congresbury" Then strParish = "frm_Congresbury" ElseIf Me.Select_Parish = "Dundry" Then strParish = "frm_Dundry" ElseIf Me.Select_Parish = "East Brent" Then strParish = "frm_EastBrent" ElseIf Me.Select_Parish = "East Harptree" Then strParish = "frm_EastHarptree" ElseIf Me.Select_Parish = "Easton in Gordano" Then strParish = "frm_EastonInGordano" ElseIf Me.Select_Parish = "Flax Bourton" Then strParish = "frm_FlaxBourton" ElseIf Me.Select_Parish = "Hewish" Then strParish = "frm_Hewish" End If DoCmd.OpenForm strParish End Sub
runtime error 2492
the action or method requires a Form Name argument
and when I debug the lineis in yellow.Code:DoCmd.OpenForm strParish
A search for error tells me I'm missing DLLs and need to download/re install windows dlls.
This does not ring true so I'm suspecting the message is generic and my code is faulty but thought I'd ask just in case as my pc carried out a large win10 update yesterday
thanks
Ian