Opening forms

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hello everyone,

I have a problem with opening forms.I have situation with 8 forms (small
ones!) which must be open based on values in ComboBox1 and ComboBox2.

imagin situation: if the cmbOne=5e and cmbTwo=UTP open Form1,
if the cmbOne=5e and cmbTwo=FTP open Form2,
if the cmbOne=6 and cmbTwo=UTP open Form3 (I have 8 forms),

How can I do it?

thanks
 
Steve

You've describe a "how" (how you are trying to do something).

If you provide a bit more description of "what" (what will the user be able
to accomplish) rather than how you are trying to do (?undefined), the
newsgroup readers may be able to offer alternate approaches (or not,
depending, but without an idea of the eventual goal, ...?!)

More specific descriptions allow for more specific suggestions.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
Microsoft IT Academy Program Mentor
 
Steve

(and if you'd rather not, consider creating a command button and inserting a
Select Case statement to handle the different combinations)

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
Microsoft IT Academy Program Mentor
 
Hello Jeff,

I have explained situation what I want to acomplish:

in cmbKategorija I have 2 values (text): 5e and 6,
in cmbVrstaKabela I have 4 values (text):UTP, FTP,STP and SSTP
there is 8 possible combinations (I have created 8 forms).Now, when I have
for example, in cmbKategorija value 6 and in cmbVrstaKabela value FTP, when
I press CommandButton (cmdChoose) I want to be opened Form6 (for example).
can you tell me please how does code looks like?

thank you
 
Hello, I have tried like this, but I have Eror - control does not have
focus,

can you tell me please where I do wrong,

Private Sub cmdOdlazniPanel_Click()

Dim stDocName As String
Dim stLinkCriteria As String


Set db = CurrentDb

txtKategorija.SetFocus
txtVrstaKabela.SetFocus


Select Case txtKategorija.Text And txtVrstaKabela.Text

Case txtKategorija = "5e" And txtVrstaKabela = "UTP"

stDocName = "frmPanelUTP5e"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Case txtKategorija = "6" And txtVrstaKabela = "UTP"
stDocName = "frmPanelUTP6"
DoCmd.OpenForm stDocName, , , stLinkCriteria


End Select

End Sub
 
Here is what you need:

Dim strSelectForm As String
Dim strDocName As String

strSelectForm = Me.cmbKategorija & Me.cmbVrstaKabela
Select Case strSelectForm
Case "5eUTP"
strDocName = "Form1"
Case "5eFTP"
strDocName = "Form2"
Case "5eSTP"
strDocName = "Form3"
Case "5eSSTP"
strDocName = "Form4"
Case "6UTP"
strDocName = "Form5"
Case "6FTP"
strDocName = "Form6"
Case "6STP"
strDocName = "Form7"
Case "6SSTP"
strDocName = "Form8"
End select

Docmd.OpenForm strDocName
 
Steve

Please re-read my response. I understand "how" you are trying to do
something. I was pointing out that a more complete description of "why"
(the business need behind the how) would help readers offer appropriate
suggestions.

It appears Klatuu has offered an approach.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP
Microsoft IT Academy Program Mentor
 
I agree. I appears Steve is interested in making the approach he's selected
work. I only asked in case there might be other solutions to the underlying
need...

Jeff Boyce
<Office/Access MVP>
 
I certainly understand. It did seem an odd way to go. He is doing a couple
of things right off the bat that would raise curiosity.

First, he is putting intelligence in his data.
Second, 8 different forms to work on what seems to be pretty much the same
thing is suspect.
 
I certainly understand. It did seem an odd way to go.

What seems odd to me is that an experienced Access developer like you would
simply give a solution without addressing the "apparent oddity" of the
desired solution, and suggesting, as Jeff has done, that if the poster would
explain what he has and what he is trying to accomplish, someone might be
able to suggest a simpler or more effective solution.

Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top