Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This MAY stump you.....

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
Hello all, here's my problem
I have on a form, a drop-down box displaying 36 time slots (4 per hour) per an 8 hour day.
This form, allows user (sales people) to only enter 4 job requests per hour from 10:00 AM to 6:00 PM
giving them a 45 minute window to have a job completed.

My problem is that if a user (sales people) needs to input something at 5:30 PM to be due at 7:00 PM
they are not able to, because on a 45 minute window 5:15 pm was the last time they could've entered something
to be done by 6:00 PM

My questions is:
How can I not make this code IGNORE 6:00 PM AT ALL?
I can't figure it out to save my life.


newtime = TimeSerial(hour(now), minute(now) + 45,second(now))
sql = "Select timedue_id from run_tbl where done = False and date1 = #" & date & "#"
dim mytimes
set mytimes=server.createobject("adodb.recordset")
mytimes.open sql, "dsn=matte"

sql99 = "select * from timedue_tbl where timedue > #" & newtime & "#"
do while not mytimes.eof
sql99 = sql99 & &quot; and id <> &quot; & mytimes(&quot;timedue_id&quot;)
mytimes.movenext
loop
sql99 = sql99 & &quot; order by timedue&quot;
&quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Paul must've taken the day off :-( today. &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
. &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
>something at 5:30 PM to be due at 7:00 PM they are not
>able to,
I presume they want to enter something due at 6:00??????

Your 'newtime' is 'now'+45 minutes, so 'timedue > newtime' (the crucial part of the SQL-statement) shows at 5:30 o'clock times after 6:15...
Apparently it is oke to enter something with a shorter job-completion time? What is the absolute minimum time?
Maybe it is default 45 minutes, and you want to overrule this? Then the 45 minutes is a variable....

br
Gerard
 
. &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Please rephrase this question:

How can I not make this code IGNORE 6:00 PM AT ALL?

I can't make sense of it...

The code seems simple enough, but I can't understand what you are asking --
 
There you are bro :)

I meant to ask:
How can I make the code IGNORE 6:00 PM after 5:15 pm &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Meaning that users will be able to select 6:00 pm for a due time on a project or anytime after 6:00 pm.
Makes sense? &quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
dim theInterval
if hour(now()) = 17 and minute(now()) > 15 then
theInterval = 45 - (60 - minute(now()))
else
theInterval = 45
end if

newtime = TimeSerial(hour(now), minute(now) + theInterval ,second(now))

You would have to add some conditions, however, that would account for if it was past 6 (because that's the only exception this is gonna catch), or before opening time, etc...

But I **think** that's the general idea of what you're after. Still not totally sure, though... so if I'm off base, lemme know.

Even if I am off base, though -- what you are needing to do here is to calculate, at runtime, theInterval via some function of current time -- so what I have there should be able to adapt to what you need even if I missed your question (which I think I have)

:)
Paul Prewett
 
Here's what I ended up doing Paul,
I created a separate entry for a new time slot on out DB and on our SQL we said:
sql = &quot;select * from times table where timedue > #&quot; & newtime & &quot;# and id <> 37&quot;

37 being the next available id were I inserted a time after 6:00 PM
This is working great now bro,thank for your input
Man, It seems a round of gold this past weekend cleared my head
&quot;The reward of one duty done is the power to fulfill another&quot;
<%
Jr Clown
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top