Parameter Query Form Help

G

Guest

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.
 
G

Guest

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)
 
G

Guest

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

Top