Parameter Query Form Help

S

Soriah

I'm new to working with Access, so bear with me. I've created a database
where I need to make a Query Parameter Form. I have the form set up and am
close to getting it to work. Anyway, here’s my SQL Statement:

SELECT Main, Submenu, Pictures
FROM TABLENAME
WHERE [Main] Like IIf(Forms!Form3!Main Is Null,"*",Forms!Form3!Main) And
[Submenu] Like IIf(Forms!Form3!Submenu Is Null, "*",Forms!Form3!Submenu);

The Main field and the query itself show the correct information; however, I
want the Submenu field to 'group' with the Main field and show only the
Submenu fields that 'belong' to the Main field instead of showing every
instance of the Submenu field (I hope this makes sense).

I'm sure the answer to this is very simplistic. Thanks.
 
O

Ofer Cohen

Try something like

SELECT Main, Submenu, Pictures
FROM TABLENAME
WHERE ([Main] = Forms!Form3!Main Or Forms!Form3!Main Is Null) And
([Submenu] = Forms!Form3!Submenu Or Forms!Form3!Submenu Is Null)
 
S

Soriah

That worked! Thank you.

Ofer Cohen said:
Try something like

SELECT Main, Submenu, Pictures
FROM TABLENAME
WHERE ([Main] = Forms!Form3!Main Or Forms!Form3!Main Is Null) And
([Submenu] = Forms!Form3!Submenu Or Forms!Form3!Submenu Is Null)


--
Good Luck
BS"D


Soriah said:
I'm new to working with Access, so bear with me. I've created a database
where I need to make a Query Parameter Form. I have the form set up and am
close to getting it to work. Anyway, here’s my SQL Statement:

SELECT Main, Submenu, Pictures
FROM TABLENAME
WHERE [Main] Like IIf(Forms!Form3!Main Is Null,"*",Forms!Form3!Main) And
[Submenu] Like IIf(Forms!Form3!Submenu Is Null, "*",Forms!Form3!Submenu);

The Main field and the query itself show the correct information; however, I
want the Submenu field to 'group' with the Main field and show only the
Submenu fields that 'belong' to the Main field instead of showing every
instance of the Submenu field (I hope this makes sense).

I'm sure the answer to this is very simplistic. Thanks.
 

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

Similar Threads

IIF IsNull help 6
QBF & Query Malfunction 0
Populate main form from subform record 0
Nested Sub Menus 3
Parameter prompt when form is open 2
HELP! 1
Multiple parameter query 1
A menu question 1

Top