-
Jun 19th, 2021, 03:52 PM
#1
Thread Starter
Lively Member
ComboBox results linked to specific Form
I have a ComboBox on Form1 with a list of about 40 specific names from the drop down list. Example Site 1, Site 2, Site 3 etc... What I'd like is, if you select say Site 1 from the drop down menu it would go to Form2. Thanks in advance!
-
Jun 19th, 2021, 04:01 PM
#2
Re: ComboBox results linked to specific Form
Why not use a menu as a menu?
Barring that, what's the question? Use a Select Case or equivalent for your various actions.
-
Jun 19th, 2021, 05:04 PM
#3
Thread Starter
Lively Member
Re: ComboBox results linked to specific Form
Originally Posted by dilettante
Why not use a menu as a menu?
Barring that, what's the question? Use a Select Case or equivalent for your various actions.
Sorry, but I do not know how to write a Select Case statement
-
Jun 19th, 2021, 08:53 PM
#4
Re: ComboBox results linked to specific Form
from form2
Code:
text1 = form1.combo1.text
change form names and controls to suit
or you can do the same from form1 by prefixing the control on form2 with the form name, even before you show form2
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 19th, 2021, 10:46 PM
#5
Thread Starter
Lively Member
Re: ComboBox results linked to specific Form
Attachment 181687 Not sure what text1 is referring to. Basically if Site 1 is selected from drop down menu then open Form2
-
Jun 19th, 2021, 10:55 PM
#6
Thread Starter
Lively Member
Re: ComboBox results linked to specific Form
Just figured it out. Thanks anyway for any help. I was trying to hard!
Private Sub Combo1_Click()
If "Site 1" = Form1.Combo1.Text Then
Form2.Show
Form1.Hide
End If
End Sub
-
Jun 20th, 2021, 12:40 AM
#7
Re: ComboBox results linked to specific Form
Select case is pretty simple and is easy to find examples of how to use it, all you have to do is look.
Code:
Select Case Combo1.Text
Case "Site 1"
'some code here to do what you want in that case
Case "Site 2"
' some code here to handle this case
'and so on as many cases as is needed
End Select
-
Jun 20th, 2021, 06:11 AM
#8
Re: ComboBox results linked to specific Form
Sam I am (as well as Confused at times).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|