473,413 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Incrementing time from an input time?

I am working on an application in which the end user will enter a
time, Say 3:00 PM, and a number, say 5

I want to create a number of records (5) as follows,

3:00:00
3:00:01
3:00:02
3:00:03
3:00:04

etc.

I created an expression that creates the records but I can't figure
out how to get them to increment.

I tried adding #00:00:01# but access converts that to #12:00:00 AM#

Any help would be greatly appreciated.
Nov 12 '05 #1
4 1984
Shyguy wrote:
I am working on an application in which the end user will enter a
time, Say 3:00 PM, and a number, say 5

I want to create a number of records (5) as follows,

3:00:00
3:00:01
3:00:02
3:00:03
3:00:04

etc.

I created an expression that creates the records but I can't figure
out how to get them to increment.

I tried adding #00:00:01# but access converts that to #12:00:00 AM#

Any help would be greatly appreciated.

See DateAdd in help

Nov 12 '05 #2
Easiest do create the records with code, using a loop:

Dim rs As DAO.Recordset
Dim dtStart As Date
Dim lngMinutes As Long

Set rs = dbEngine(0)(0).OpenRecordset("YourTableNameHere")
stStart = #15:00:00# '3pm.
For lngMinutes = 0 To 5
rs.AddNew
rs![YourTimeField] = DateAdd("n", dtStart, lngMinutes)
'any other fields on separate lines here.
rs.Update
Next
rs.Close
Set rs = Nothing

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Shyguy" <Sh****@shytown.com> wrote in message
news:ek********************************@4ax.com...
I am working on an application in which the end user will enter a
time, Say 3:00 PM, and a number, say 5

I want to create a number of records (5) as follows,

3:00:00
3:00:01
3:00:02
3:00:03
3:00:04

etc.

I created an expression that creates the records but I can't figure
out how to get them to increment.

I tried adding #00:00:01# but access converts that to #12:00:00 AM#

Any help would be greatly appreciated.

Nov 12 '05 #3
On Thu, 29 Apr 2004 06:04:02 GMT, Salad <oi*@vinegar.com> wrote:
Shyguy wrote:
I am working on an application in which the end user will enter a
time, Say 3:00 PM, and a number, say 5

I want to create a number of records (5) as follows,

3:00:00
3:00:01
3:00:02
3:00:03
3:00:04

etc.

I created an expression that creates the records but I can't figure
out how to get them to increment.

I tried adding #00:00:01# but access converts that to #12:00:00 AM#

Any help would be greatly appreciated.

See DateAdd in help


Thanks very much,

DateAdd did the trick..
Nov 12 '05 #4
Hi,

Would this function be of any use? (copied from the Help files).
TimeSerial Function
Returns a Variant (Date) containing the time for a specific hour, minute,
and second.

Syntax

TimeSerial(hour, minute, second)

The TimeSerial function syntax has these named arguments

Part Description
hour Required; Variant (Integer). Number between 0 (12:00 A.M.) and 23
(11:00 P.M.), inclusive, or a numeric expression
minute Required; Variant (Integer). Any numeric expression.
second Required; Variant (Integer). Any numeric expression.

"Shyguy" <Sh****@shytown.com> wrote in message
news:ek********************************@4ax.com...
I am working on an application in which the end user will enter a
time, Say 3:00 PM, and a number, say 5

I want to create a number of records (5) as follows,

3:00:00
3:00:01
3:00:02
3:00:03
3:00:04

etc.

I created an expression that creates the records but I can't figure
out how to get them to increment.

I tried adding #00:00:01# but access converts that to #12:00:00 AM#

Any help would be greatly appreciated.

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mothra | last post by:
Here's what I'm trying to do (kill off old Unix logins): --------------------- $i=0; while (<$who>) { chomp($_); my @line = split(/\s+/, $_); # Split it into an array next unless ($line...
2
by: brian | last post by:
Hi, before coming to .NET, I utilized regular expressions mostly in JScript / JavaScript and also in my favorite text editor: TextPad (www.textpad.com) I don't know about JScript/JavaScript, but...
4
by: Shyguy | last post by:
I am working on an application in which the end user will enter a time, Say 3:00 PM, and a number, say 5 I want to create a number of records (5) as follows, 3:00:00 3:00:01 3:00:02 3:00:03...
6
by: Captain Dondo | last post by:
I've got an embedded system that uses a javascript-enabled browser as a front end. The input system consists of an encoder which generates + and - chars, and a couple of keys that generate Tab...
8
by: mantrid | last post by:
Hello I have the following code, where clicking yh1r is supposed to move h1 10px down and update the value of yh1 by 20 each time its clicked. what the code actually does is NOT move h1 and...
3
by: Adam Sandler | last post by:
Hello, I'm able to reproduce my problem but I haven't been able to figure out why it is happening. MS does have an article about such behavior in...
4
by: masterpaladin38 | last post by:
I've been working on this problem for some time and I must say I'm stump. Any help would be appreciated. Basically what I'm trying to do is write the results of a loop to a new text file with...
7
by: jwhitby3 | last post by:
Hi all, I am trying to develop what amounts to a data entry page for the company I work for, (mostly to make my job easier). I think that I am beginning to grasp php, but I am at a loss now. I...
8
by: arachno | last post by:
My Oracle sequences seem to be auto-incrementing themselves "over time". My row ID's are sequenced like this: 1, 4, 5, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 41, etc I'm using...
9
by: subramanian100in | last post by:
The following portion is from c-faq.com - comp.lang.c FAQ list · Question 6.13 int a1 = {0, 1, 2}; int a2 = {{3, 4, 5}, {6, 7, 8}}; int *ip; /* pointer to int */ int (*ap); /* pointer to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.