473,378 Members | 1,721 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,378 software developers and data experts.

Validate Time in MS Access 2000

Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James
Nov 13 '05 #1
6 1532
"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James


Perhaps have seperate text boxes for "hours" and "minutes" ? Then it is
easy to enter a validation rule for each

Minutes -> 0 or 15 or 30 or 45
Hours -> 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12

???
--
regards,

Bradley
Nov 13 '05 #2
First, WorkTime needs to be a Single datatype.

(Me!WorkTime - Int(Me!WorkTime)) MOD .25 = 0

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James

Nov 13 '05 #3
"PC Datasheet" <no****@nospam.spam> wrote in message news:<5x******************@newsread3.news.atl.eart hlink.net>...
First, WorkTime needs to be a Single datatype.

(Me!WorkTime - Int(Me!WorkTime)) MOD .25 = 0

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James


Wow, thank you so much for both of the responses. You guys are so
brilliant! I love both of the solution and will try them. Two good
tricks. I'm really appreciated.

James
Nov 13 '05 #4
James,

My solution doesn't work as is! MOD only works with whole numbers. Change my
solution to:
100*(Me!WorkTime - Int(Me!WorkTime)) MOD 25 = 0

Steve
PC Datasheet
"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
"PC Datasheet" <no****@nospam.spam> wrote in message

news:<5x******************@newsread3.news.atl.eart hlink.net>...
First, WorkTime needs to be a Single datatype.

(Me!WorkTime - Int(Me!WorkTime)) MOD .25 = 0

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"James P." <ha*********@yahoo.com> wrote in message
news:f4**************************@posting.google.c om...
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James


Wow, thank you so much for both of the responses. You guys are so
brilliant! I love both of the solution and will try them. Two good
tricks. I'm really appreciated.

James

Nov 13 '05 #5
ha*********@yahoo.com (James P.) wrote in message news:<f4**************************@posting.google. com>...
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James


If Nz(Me!WorkTime) * 4 - Int(Nz(Me!WorkTime) * 4) > 0.03 Then boolValid = False

works for hours limited to two decimal places.

James A. Fortune
Nov 13 '05 #6
ja******@oakland.edu (James Fortune) wrote in message news:<a6**************************@posting.google. com>...
ha*********@yahoo.com (James P.) wrote in message news:<f4**************************@posting.google. com>...
Hello there,

I have a data bound text field containing worked time: hour and minute
the user worked. The rule is the user can only enter the minute in
the increment of 25. The reason for that is manager only care about
at least 15 minutes worked.

So, say the user worked for 2 hours 15 minutes, in the text box, they
need to enter: 2.25. If they worked for 4 hours 45 minutes, they
enter 4.75. If 5 hours, they enter: 5 or 5.0. They can enter any
hour (any number before the period is considered hour).

Are there anyway I can set my validation to prevent the user to enter
the minutes not in 0, 25, 50, or 75? . So, anything like these are
invalid: 3.15, 3.33, 3.17, 3.89, etc. In that case, I want to display
a message box.

Thanks in advance,
James


If Nz(Me!WorkTime) * 4 - Int(Nz(Me!WorkTime) * 4) > 0.03 Then boolValid = False

works for hours limited to two decimal places.

James A. Fortune


Thanks a lot, guys. I'll give it a try.

James
Nov 13 '05 #7

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

Similar topics

3
by: Jay | last post by:
I previously posted this question under Visual Basic newsgroup, but was advised to re-post here. I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000. Here's...
4
by: Alonso | last post by:
Hello everybody! :-D I am trying to validate a select object in a form. It does not work fine in Explorer 6.0 because it always send the form, but in Netscape 7.0 it works really fine. The code...
0
by: SHC | last post by:
Hi all, I have a VC++ .NET 2003 - Windows XP Pro PC. I created a Win32 console application in my VC++ .NET 2003 and copied validateDOM.cpp, books.xml and books.xsd (see the attached files below)...
1
by: L Mehl | last post by:
On my cmdSaveRecord, I check a couple of fields to confirm that an entry has been made before allowing the Save. I decided to - not put validation rules in table structure, and - validate on...
2
by: Steve Miller | last post by:
hello... i am a 'user' of access, meaning, i import excel files, join, and merge....that's about the extent of my expertise with ms-access. my boss wants me to create an access application that...
5
by: sjl | last post by:
I've got an .aspx webform for searching my database. It basically takes user input and passes it as a parm into a stored proc to search a table. The results are returned in a SQLDataReader and...
3
by: Mike Logan | last post by:
How do I validate messages? If my schema has a simpleType with facets like "minExclusive" and "maxLength" will the .Net framework validate the message before running the web service? This is what...
10
by: gmocnik | last post by:
I am validating XML files on a server which has no internet access and the validadation in C# does not work. Schema with which I am validating has namespaces like:...
2
by: Mick Walker | last post by:
Hi, I have a problem that I have been trying to figure for a couple of days, and am wondering if anyone out there would be so kind as to give me a solution. (Deadline time) I am trying to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.