help with query (Newbie)

C

colmobrien

I have two tables and need help with a query
Table 1 is a lookup table fields monthno 1-12 and month name January-
December
Table 2 lots of fields but 2 important to this query yearendmonth which is
jan- dec from table1 and yearendday 1-31 corresponding to day in moth when
companies accounts are due.

i want to interogate table2 to return all details up to dategiven eg 4th
June so all where month number is < 6 and those where month no is 6 and
daynumber <=4

my knowledge is limited i am working in design view and all help is greatly
appreciated.

colm
 
T

Ted Allen

Creat a query based on your table(s). Then, for your
criteria, enter <6 under the month number on the first
criteria row, and enter 6 as the criteria for the
monthnumber on the row just below (the second criteria
row) and on that same second row enter <=4 in the
daynumber colum.

Access treats all criteria on a given line as an AND
condition, but criteria on separate lines are treated as
an OR condition. So, the criteria above would select all
records where the month number is less than 6 OR where
the month number is equal to 6 AND the day number is less
than or equal to 4.

Hope that helps.

-Ted Allen
 
C

colmobrien

Ted thank's that explains part of my problem but I want the User to enter
the month as April but i want then to return data where month number is less
than or equal to 4.

rather than entering the month as 4

colm
 
T

Ted Allen

Oh, in that case, one way that comes to mind would be to
have the user select the month from a combo box on a
form. The combo box would be bound to the month number,
but the first column width would be set to 0 so that it
would display the month names. Then, have the query
reference the control on the form such as

Forms!YourFormName!YourFieldName

or if the names have spaces;

Forms![Your Form Name]![Your Field Name]

A day can also be referenced in a similar manner. The
form has to be open when the query is run.

Hope that helps.

-Ted Allen
 

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