Avatar of gliese581
gliese581
 asked on

(very) simple program design question

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

Microsoft DevelopmentWeb Components

Avatar of undefined
Last Comment
Mike Tomlinson

8/22/2022 - Mon
SOLUTION
Daniel Wilson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
gliese581

ASKER
Thank you DanielWilson.

Which would you recommend?  Which is the better interface?

I plan to design an icon for the application. The user will launch it, and answer yes, no, yes, no... through a hierarchy to get to one of 1200 documents.

I assume that if I use a Form I could (at my option) make it look just like a yes/no msgbox depending on the selection of controls.  

What's the benefit of the Console application? Is it just that it's most similar to my Access module??
Daniel Wilson

A console app runs from a command prompt (often still called a DOS prompt).  If you're offering message boxes & other visual stuff, I'd have a form for it.


ASKER CERTIFIED SOLUTION
Mike Tomlinson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
gliese581

ASKER
Sorry. Just one more question.  I've never done this, but I sort-of follow, at least in concept.

I know how to nest the msgboxes in a Module.  Seems like an efficient way to code this if there's going to be tons of nesting.

If I go with the Forms option, how do I go from Form, to Form, to Form, to Form, to the document that need to ultimately be displayed?  How does one Form point to another, and is there an effiient way to duplicate and edit forms if there are goint to be tons of them?

This is going to be a highly interactive system.  In the end, it's artificial intelligence.  Each Form (or msgbox) is a question (or decision).  there will be tons of decisions.

Should I use Forms, or just code msgboxes in a module?  I want to give the users pretty boxes, but not if it's prohibitively less efficient to code.  Please HELP!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Mike Tomlinson

Based on your previous code I would just use MsgBoxes.  Only use seperate forms if you need to present/get more information than will comfortably fit in the MsgBox...or if you need to make it "pretty".
gliese581

ASKER
If I go with the Forms alternative, is the a way to manage them?  Are there reports or diagrams that display hierarchies?
Mike Tomlinson

You could use a TabControl...but it's a real PAIN in VB6.    (nice to work with though in VB.Net)
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.