Parameter Query Form Help

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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)
 
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.
 
Back
Top