Update or Append Help with Criteria

L

Lou

Good Day!

I have 2 tables;

1st is "tblQuarters" with the following data,
[FiscalYear],[Quarter],[Begin] and [End] - begin and end
are the beginning date and ending date.

2nd is "tblMain2" - which has [Definite] and [Quarter] -
the quarter is blank currently and the definite has a date.

The "tblMain2" table is updated based of an append query
which I will update each quarter. what I need to do though
is have a query update the quarter based of
my "tblQuarter", I am not sure what direction to go here,
a vlookup maybe or an IIF..? So in recap, have a query
look up the [definite] date in "tblmain2" in
the "tblQuarters" table and bring back the right quarter
based on its date and update "tblMain2" [Quarter].

Thank you.
Lou
 
M

MGFoster

Lou said:
Good Day!

I have 2 tables;

1st is "tblQuarters" with the following data,
[FiscalYear],[Quarter],[Begin] and [End] - begin and end
are the beginning date and ending date.

2nd is "tblMain2" - which has [Definite] and [Quarter] -
the quarter is blank currently and the definite has a date.

The "tblMain2" table is updated based of an append query
which I will update each quarter. what I need to do though
is have a query update the quarter based of
my "tblQuarter", I am not sure what direction to go here,
a vlookup maybe or an IIF..? So in recap, have a query
look up the [definite] date in "tblmain2" in
the "tblQuarters" table and bring back the right quarter
based on its date and update "tblMain2" [Quarter].

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Guesses:

UPDATE tblMain2 As M
SET M.[Quarter] = DLookup("[Quarter]", "tblQuarters",
M.[Definite] & " Between [Begin] And [End]" )

Or:

UPDATE tblMain2 As M, tblQuarters As Q
SET M.[Quarter] = Q.[Quarter]
WHERE M.[Definite] Between Q.[Begin] And Q.[End]


- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQFY7/IechKqOuFEgEQK0ngCgy732gkyH3MkHi1v+2DZGIxY2Ny8AnR+K
rTrwWhgqwhzs5oVHF0LJ5lvE
=EWxp
-----END PGP SIGNATURE-----
 

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