Hello, i'm new to this forum and to MS Access in general so any help would be appreciated.
I'm trying to do the following:
1)I have to combo boxes on my form, Combo1, and Combo2
2)Combo1 is visible, Combo2 is invisible at first
3)when i select an entry in Combo1, Combo2 becomes visible, and the choices in Combo2 depend on what i chose in Combo1
Example:
Choices in Combo1:
-Firstnames
-Lastnames
Choices in Combo2
-If Firstnames chosen in Combo1
--[list of first names]
-If Lastnames chosen in Combo1
--[list of last names]
(NOTE -(dash) is used for indentation, not a part of an actual code)
Private Sub Combo1_Click()
--Dim c As Long
--c = Forms![Main Menu]![Combo1].ListIndex
--If c = 0 Then ' if first index is chosen
----Forms![Main Menu]![Combo2].Visible = True
----Forms![Main Menu]![Combo2]!ControlSource = [Firstnames]
--Else If c = 1 Then ' if second index is chosen
----Forms![Main Menu]![Combo2].Visible = True
----Forms![Main Menu]![Combo2]!ControlSource = [Lastnames]
--End If
End Sub
[Firstnames] and [Lastnames] are columns in the Table names
i tried different variations insted of the [Firstnames] and [Lastnames],
I had ControlSource = [names].[Firstnames] -> (Error 2465, see below)
I had ControlSource = "Fistnames" -> (Error 451, see below)
They all give me errors, Does anyone knows what the error might be or if there is a better way of doing it
-> ERROR 2465 Microsoft Access can't find the field '|' refered to in your expression.
-> ERROR 451 Property let procedure not defined and property get procedure did not return an object
I'm trying to do the following:
1)I have to combo boxes on my form, Combo1, and Combo2
2)Combo1 is visible, Combo2 is invisible at first
3)when i select an entry in Combo1, Combo2 becomes visible, and the choices in Combo2 depend on what i chose in Combo1
Example:
Choices in Combo1:
-Firstnames
-Lastnames
Choices in Combo2
-If Firstnames chosen in Combo1
--[list of first names]
-If Lastnames chosen in Combo1
--[list of last names]
(NOTE -(dash) is used for indentation, not a part of an actual code)
Private Sub Combo1_Click()
--Dim c As Long
--c = Forms![Main Menu]![Combo1].ListIndex
--If c = 0 Then ' if first index is chosen
----Forms![Main Menu]![Combo2].Visible = True
----Forms![Main Menu]![Combo2]!ControlSource = [Firstnames]
--Else If c = 1 Then ' if second index is chosen
----Forms![Main Menu]![Combo2].Visible = True
----Forms![Main Menu]![Combo2]!ControlSource = [Lastnames]
--End If
End Sub
[Firstnames] and [Lastnames] are columns in the Table names
i tried different variations insted of the [Firstnames] and [Lastnames],
I had ControlSource = [names].[Firstnames] -> (Error 2465, see below)
I had ControlSource = "Fistnames" -> (Error 451, see below)
They all give me errors, Does anyone knows what the error might be or if there is a better way of doing it
-> ERROR 2465 Microsoft Access can't find the field '|' refered to in your expression.
-> ERROR 451 Property let procedure not defined and property get procedure did not return an object