Macros to update table?

  • Follow


Hi,

Okay, here's what I'm trying to do... I have a form, and I want to be
able to automatically log the time that users are working on that
particular project. This is my thought process, and I just can't get
it to work. I'm using Access2000, and I'm still somewhat new to
figuring it out.

1st Time button - start time - this would be a macro that goes and
updates a table that has the start time, end time, project id and an
autonumber field (so it will just keep adding to the table). There
would be a date & time stamp that goes into the start time column.

2nd Time button - end time - Same basic function - it would put a date/
time stamp into the end time field.

I want to use this to create a record to show how long the user was
working on the project (end time - start time = time worked). I've
tried setting up macros, and I can't get them to actually update the
table. I've had little experience with macros and I could really use
some help.

Thanks!

Gretchen

0
Reply gretchenschaeffer 8/8/2007 10:05:51 PM

gretchenschaeffer@gmail.com wrote in
news:1186610751.771544.297850@o61g2000hsh.googlegroups.com: 

> Hi,
> 
> Okay, here's what I'm trying to do... I have a form, and I
> want to be able to automatically log the time that users are
> working on that particular project. This is my thought
> process, and I just can't get it to work. I'm using
> Access2000, and I'm still somewhat new to figuring it out.
> 
> 1st Time button - start time - this would be a macro that goes
> and updates a table that has the start time, end time, project
> id and an autonumber field (so it will just keep adding to the
> table). There would be a date & time stamp that goes into the
> start time column. 
> 
> 2nd Time button - end time - Same basic function - it would
> put a date/ time stamp into the end time field.
> 
> I want to use this to create a record to show how long the
> user was working on the project (end time - start time = time
> worked). I've tried setting up macros, and I can't get them to
> actually update the table. I've had little experience with
> macros and I could really use some help.
> 
> Thanks!
> 
> Gretchen
> 
You need two queries, one to append a new record to the table 
filling in the user's name or id, the project id and the 
date/time. you could run this from a macro or 1 line of visual 
basic in the OnClick event of your button. You don't need an 
autonumber.

The second query is a little more complex, because you have to 
find then update an existing record, the one created previously, 
so you need as criteria the user id, the project and either the 
most recent start, or the start with no end.

Then you run this query using a macro or code  from the en time 
button, and from the form's OnClose event, in case the user 
forgot to click the end time button.



-- 
Bob Quintal

PA is y I've altered my email address.

-- 
Posted via a free Usenet account from http://www.teranews.com

0
Reply Bob 8/8/2007 10:21:17 PM

The macro action is OpenQuery.

You actually need two types of queries. You need an append query to add a 
new record to the table when the user begins working on a project (and to 
put in the start time). Then you need an update query to modify that record 
with the end time when the user is done.

Have this action run an update query. The queries will need to read data 
from the open form to get the ProjectID value, most likely.
-- 

        Ken Snell
<MS ACCESS MVP>


<gretchenschaeffer@gmail.com> wrote in message 
news:1186610751.771544.297850@o61g2000hsh.googlegroups.com...
> Hi,
>
> Okay, here's what I'm trying to do... I have a form, and I want to be
> able to automatically log the time that users are working on that
> particular project. This is my thought process, and I just can't get
> it to work. I'm using Access2000, and I'm still somewhat new to
> figuring it out.
>
> 1st Time button - start time - this would be a macro that goes and
> updates a table that has the start time, end time, project id and an
> autonumber field (so it will just keep adding to the table). There
> would be a date & time stamp that goes into the start time column.
>
> 2nd Time button - end time - Same basic function - it would put a date/
> time stamp into the end time field.
>
> I want to use this to create a record to show how long the user was
> working on the project (end time - start time = time worked). I've
> tried setting up macros, and I can't get them to actually update the
> table. I've had little experience with macros and I could really use
> some help.
>
> Thanks!
>
> Gretchen
> 


0
Reply Ken 8/8/2007 10:39:03 PM

2 Replies
762 Views

(page loaded in 0.499 seconds)

Similiar Articles:
















7/20/2012 9:51:14 PM


Reply: