PC Review Forums Newsgroups Microsoft Access Microsoft Access VBA Modules Automatically fetch data from table

Reply

Automatically fetch data from table

 
Thread Tools Rate Thread
Old 13-09-2009, 04:28 PM   #1
manolakshman
Guest
 
Posts: n/a
Default Automatically fetch data from table


I have 2 tables Emp_Name & Muster. For every single day i need to pick all
the entries in EMp_name. Is there any way to program it, so that I dont need
to copy and paste it every time
  Reply With Quote
Old 13-09-2009, 05:36 PM   #2
John Spencer
Guest
 
Posts: n/a
Default Re: Automatically fetch data from table

If you want to create records in Muster for a specific date, then you might
use an append query.

INSERT INTO Muster (EmpID, MusterDate)
SELECT EmpId, Date() as Today
FROM Emp_Name

Or you can use a query as the source. You need to give a bit more detail as
to the structure of your tables. I am guessing that you have an EmpID field
in both tables and a MusterDate field. You can construct a query based on the
two tables that will show EmpID and a blank field for the musterdate.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

manolakshman wrote:
> I have 2 tables Emp_Name & Muster. For every single day i need to pick all
> the entries in EMp_name. Is there any way to program it, so that I dont need
> to copy and paste it every time

  Reply With Quote
Old 17-09-2009, 07:40 AM   #3
manolakshman
Guest
 
Posts: n/a
Default Re: Automatically fetch data from table

Hey this is in continuation with my earlier post, in a similar way can date
entries in a muster roll can also be done automatically for a particular
month.
For example when I give a month (say:JULY'09) as input can a query select
all the name from the 'Emp_Name' table and fill it in a 'muster roll' table.

"John Spencer" wrote:

> If you want to create records in Muster for a specific date, then you might
> use an append query.
>
> INSERT INTO Muster (EmpID, MusterDate)
> SELECT EmpId, Date() as Today
> FROM Emp_Name
>
> Or you can use a query as the source. You need to give a bit more detail as
> to the structure of your tables. I am guessing that you have an EmpID field
> in both tables and a MusterDate field. You can construct a query based on the
> two tables that will show EmpID and a blank field for the musterdate.
>
> John Spencer
> Access MVP 2002-2005, 2007-2009
> The Hilltop Institute
> University of Maryland Baltimore County
>
> manolakshman wrote:
> > I have 2 tables Emp_Name & Muster. For every single day i need to pick all
> > the entries in EMp_name. Is there any way to program it, so that I dont need
> > to copy and paste it every time

>

  Reply With Quote
Old 17-09-2009, 03:56 PM   #4
John Spencer
Guest
 
Posts: n/a
Default Re: Automatically fetch data from table

If you wish to do so, yes. You would need an auxilary table (tblNumbers) with
one field (TheNumber) contains numbers from 1 to at least 31. Then you could
use something like the following. You would enter any date in the month you
were interested in.

INSERT INTO Muster (EmpID, MusterDate)
SELECT EmpId
, DateAdd("d",[tblNumbers].[TheNumber]-1,[Enter Start Date]) as Today
FROM Emp_Name , tblNumbers
WHERE [tblNumbers].[TheNumber] Between 1 and
Day(DateSerial(Year([Enter Start Date]),Month([Enter Start Date])+1,0))

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

John Spencer wrote:
> If you want to create records in Muster for a specific date, then you
> might use an append query.
>
> INSERT INTO Muster (EmpID, MusterDate)
> SELECT EmpId, Date() as Today
> FROM Emp_Name
>
> Or you can use a query as the source. You need to give a bit more
> detail as to the structure of your tables. I am guessing that you have
> an EmpID field in both tables and a MusterDate field. You can construct
> a query based on the two tables that will show EmpID and a blank field
> for the musterdate.
>
> John Spencer
> Access MVP 2002-2005, 2007-2009
> The Hilltop Institute
> University of Maryland Baltimore County
>
> manolakshman wrote:
>> I have 2 tables Emp_Name & Muster. For every single day i need to pick
>> all the entries in EMp_name. Is there any way to program it, so that I
>> dont need to copy and paste it every time

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off