Add Current Time

  • Thread starter Thread starter Craig Coope
  • Start date Start date
C

Craig Coope

Hi,

I'm a complete novice with Access (so maybe I should give up now!) but
I'm trying add the current time into a table when pressing a toggle
button in a form.

So basically you press the "Start" button in the form and in the table
the current pc time is entered automatically.

I have no idea about code building...I'm using the Expression builder
and I have "= time()" in "onclick" and I have "Start time" as the
control source which links it to the correct column on my table.
However when I click the button all it does is enter "00:00" and not
the real time. It is obviously some default time as if I try to add
the date it adds something from the year 1899....

Hope someone can help...

Craig
 
Craig said:
Hi,

I'm a complete novice with Access (so maybe I should give up now!) but
I'm trying add the current time into a table when pressing a toggle
button in a form.

So basically you press the "Start" button in the form and in the table
the current pc time is entered automatically.

I have no idea about code building...I'm using the Expression builder
and I have "= time()" in "onclick" and I have "Start time" as the
control source which links it to the correct column on my table.
However when I click the button all it does is enter "00:00" and not
the real time. It is obviously some default time as if I try to add
the date it adds something from the year 1899....

Hope someone can help...

Craig

Is the form bound to the table? If not, does the table have only one row? If
not, is your intent to update all rows to the current Time or just a specific
row? If the latter how do you identify which row to update?

It sounds like your form is bound to the table and all you really need is for
the button to set the value of a control on the form to the current time. The
Click event code would be...

Me!ControlName = Now()
 
Hi,

I'm a complete novice with Access (so maybe I should give up now!) but
I'm trying add the current time into a table when pressing a toggle
button in a form.

So basically you press the "Start" button in the form and in the table
the current pc time is entered automatically.

I have no idea about code building...I'm using the Expression builder
and I have "= time()" in "onclick" and I have "Start time" as the
control source which links it to the correct column on my table.
However when I click the button all it does is enter "00:00" and not
the real time. It is obviously some default time as if I try to add
the date it adds something from the year 1899....

Hope someone can help...

Craig

First, if you are trying to make the toggle button equal the time, I
don't think you can. They only have a value of True and False (Up or
Down). When used in an option group they can represent other numeric
values, but not time. So perhaps if you offer more info on your
scenario, someone may offer a better solution.

Second, depending on what the purpose of this is, you could just set
the Default Value property in the table to Time(), then when the
record is created, the current time would be recorded.
 
On Mar 10, 1:39 pm, Craig Coope <[email protected]> wrote:
First, if you are trying to make the toggle button equal the time, I
don't think you can. They only have a value of True and False (Up or
Down). When used in an option group they can represent other numeric
values, but not time. So perhaps if you offer more info on your
scenario, someone may offer a better solution.

Second, depending on what the purpose of this is, you could just set
the Default Value property in the table to Time(), then when the
record is created, the current time would be recorded.

Thanks to both your replies...

I'm sorry if I was not clear...

I want to create a table with columns "start time" and "Finish
time"...When I click the "Start" button it captures the current time
and places it in an entry in the start time column. Then I will have
another button called "Stop" and again this will add the current time
to the "finish time" column. I am trying to calculate how long it
takes to complete a "job" at my work. Users will click start as they
start the job and "finish" after the job is complete. I will then use
this data in Excel to work out average job speeds etc. The Excel sheet
is already done and works well but at the moment I have to input all
the times manually. I was hoping to be able to "export" the data from
the button pushes into my Excel sheet without me having to input.

I have taken a screenie of my excel table

http://www.geocities.com/coope1999/excel.jpg

I input 4 items for each "job"

Start time
Finish Time
Lines (workload)
Time Lost

It then works out total work time and LPH (Lines per hour)

All I want is to use Access to input Start and Finish at the click of
toggle buttons.

I know that I will and to export my Access table to Excel etc but I'm
not at that part yet!

Cheers...
 
First off, why do you need Excel for this at all?
Second, what are the 3 letter headings under "name"? Are they short
forms for names, or different jobs. If so, this is a very simple thing
to do in Access on it's own.
 
First off, why do you need Excel for this at all?
Second, what are the 3 letter headings under "name"? Are they short
forms for names, or different jobs. If so, this is a very simple thing
to do in Access on it's own.


I did this in excel because at the time it is all that I needed to do.
but now I would like to go a step further...Excel doesn't just display
the data I input it also calculates it. It calcualtes individual
"jobs" and total and an average as well as counting how many jobs
there have been in a day using countifs etc...I have no idea if all
this can be done in Access...took me a while to get the correct
formulae to work as I want it in Excel...Basically the excel sheet
works very well and I jus wanted to use Access to a lesser extent to
give me the time values automatically....

The 3 letter words are names (catergories of jobs I guess)...
Basically in any one day you could do 4 jobs under Hin, 5 under Let
and 1 under Exe for example. What I took a screen grab of is not the
whole sheet...just a small part of it. Basically with the 3 letter
names I am able to count how many Hin, Let, Exe etc jobs there have
been in a day too etc....

Anyway what I want to do is more complicated than my origirnal request
but if I can my start and stop buttons to insert times into my excel
sheet in the correct fields I would be half way to my goal...but that
is another question for another day!
 
I did this in excel because at the time it is all that I needed to do.
but now I would like to go a step further...Excel doesn't just display
the data I input it also calculates it. It calcualtes individual
"jobs" and total and an average as well as counting how many jobs
there have been in a day using countifs etc...I have no idea if all
this can be done in Access...took me a while to get the correct
formulae to work as I want it in Excel...Basically the excel sheet
works very well and I jus wanted to use Access to a lesser extent to
give me the time values automatically....

The 3 letter words are names (catergories of jobs I guess)...
Basically in any one day you could do 4 jobs under Hin, 5 under Let
and 1 under Exe for example. What I took a screen grab of is not the
whole sheet...just a small part of it. Basically with the 3 letter
names I am able to count how many Hin, Let, Exe etc jobs there have
been in a day too etc....

Anyway what I want to do is more complicated than my origirnal request
but if I can my start and stop buttons to insert times into my excel
sheet in the correct fields I would be half way to my goal...but that
is another question for another day!


If you intend to mainly use Excel, I would keep everything in Excel.
You can add command buttons to spreadsheets as well, and the methods
are fairly similar - mainly beacuse you'd be referencing cells
instead of fields and controls. I don't use Excel much, so I'm afraid
I'm of little help. Perhaps one of the Excel newsgroups could be of
better assistance - or someone here with more experience.
 
If you intend to mainly use Excel, I would keep everything in Excel.
You can add command buttons to spreadsheets as well, and the methods
are fairly similar - mainly beacuse you'd be referencing cells
instead of fields and controls. I don't use Excel much, so I'm afraid
I'm of little help. Perhaps one of the Excel newsgroups could be of
better assistance - or someone here with more experience.

Ohhh!!

OK now I see that you can add these buttons on Excel too...Thanks for
the pointer....Hopefully it should be easy now...

Cheers....
 

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

Back
Top