open form ubder conditions


E

emma

Hi,

Ihave two forms, called Form1 and Form2.
Form1 contains Command1
Form2 contains combobox1 and combobox2

I want to open form2 using command1_click.
After opening me.combobox must be "3" and
me.combobox2 must be "5'.
The numbers "3"' and "5"are variabeles generated in form1.


Private Sub Command1_Click()
DoCmd.OpenForm ("form2")
' with condition:
' WHERE me.combobox LIKE "3" AND me.combobox2 LIKE "5'
End Sub



Thanks,

Emma
 
Ad

Advertisements

K

Klatuu

Your post is confusing in that I don't see anything conditional about it. If
they will always be 3 and 5, then in the Load event of form 2

With Me
.combobox1 = 3
.combobox2 = 5
End With

If that is not what you want, please clarify your question and we can help.
 
A

Albert D. Kallal

I want to open form2 using command1_click.
After opening me.combobox must be "3" and
me.combobox2 must be "5'.
The numbers "3"' and "5"are variabeles generated in form1.


docmd.OpenForm "form2"
forms!Form2.combobox = 3
forms!form2.combobox2 = 5

You don't mention what the actual vars are, but you would replace the 3 and
5 with the variable names in the above code.....
 
Ad

Advertisements

K

Klatuu

I considered including almost exactly what you propose, but didn't only
because the OP did not really make it clear.
 

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

Top