We help IT Professionals succeed at work.
Get Started

(very) simple program design question

Last Modified: 2013-11-27
I can run the attached sample code from an Access Module. Where do I put it in VB 6 to create an executable??  Is it necessarilly somehow embedded in a form?

Eventually, I will want to display one of 1200 documents selected through a similar hierarchy of yes/no dialog boxes.  Should I use VB forms or msgboxes to dialog with the user?

Public Function DecisionTree()
Dim ans_23 As Integer
Dim ans_31_33 As Integer
Dim ans_42_45 As Integer
Dim ans_48_49 As Integer
ans_23 = MsgBox("Are you a general contractor, sub-contactor, or specialized contractor?", vbYesNoCancel + vbQuestion, "Please Respond")
ans_31_33 = MsgBox("Are you engaged in agriculture, production, manufacturing, or mining of a product or commodity?", vbYesNoCancel + vbQuestion, "Please Respond")
ans_42_45 = MsgBox("Are you engaged in buying or selling of products or commodities?", vbYesNoCancel + vbQuestion, "Please Respond")
ans_48_49 = MsgBox("Are you engaged in the transportation of freight or passengers by any more including air, truck, boat, pipeline, etc.?", vbYesNoCancel + vbQuestion, "Please Respond")
    Select Case ans_31_33
        Case vbYes
            MsgBox "yes_31_33"
        Case vbNo
            Select Case ans_42_45
                Case vbYes
                    MsgBox "yes_42_45"
                Case vbNo
                    Select Case ans_23
                        Case vbYes
                            MsgBox "yes_23"
                        Case vbNo
                            Select Case ans_48_49
                                Case vbYes
                                    MsgBox "yes_48_49"
                                Case vbNo
                                  MsgBox "no_48_49"
                                Case vbCancel
                                    MsgBox "cancel_48_49"
                            End Select
                        Case vbCancel
                            MsgBox "cancel_23"
                    End Select
                Case vbCancel
                    MsgBox "cancel_42_45"
            End Select
        Case vbCancel
            MsgBox "cancel_31_33"
    End Select
End Function

Open in new window

Watch Question
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE