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

have access enter a date automatically that is not the current date

54
I have a form where employees are typing in information throughout a shift and that information is save to a table called "anodic unload sheet". It automatically inserts the date into a field. We have a night shift from 6:00PM through 6:00AM and I want the date inserted into the table to change at the end of the shift instead of midnight. Is this possible? Thanks in advance.
Jul 13 '12 #1

✓ answered by NeoPa

The following code within the SQL of your query will do exactly what you require :
Expand|Select|Wrap|Line Numbers
  1. DateValue(DateAdd('h',-6,Now()))

4 1911
modify the table design. set the default to a user-defined function that changes the default value based on the current time. In that function check the time and depending on the time value set the default date.
Jul 13 '12 #2
Becker
54
I just barely discovered a way to do this. Here is what I did.
Expand|Select|Wrap|Line Numbers
  1. If Me.Time.Value > "12:00:01 AM" And Me.Time.Value < "6:00:00 AM" Then
  2. Me.date.Value = DateValue(Now - 1)
  3. Else: Me.date.Value = DateValue(Now)
  4. End If
Thanks for your suggestion anyway though.
Jul 13 '12 #3
Rabbit
12,516 Expert Mod 8TB
Use the iif() function to return the prior day if the time is before 6 am.
Jul 14 '12 #4
NeoPa
32,556 Expert Mod 16PB
The following code within the SQL of your query will do exactly what you require :
Expand|Select|Wrap|Line Numbers
  1. DateValue(DateAdd('h',-6,Now()))
Jul 14 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Luigi | last post by:
Imagine I have a small, static, personal site (I do, actually: http://kirpi.it/). And imagine that, just below the title of the page, I would like to have a comment, or a news line, or a birthday...
2
by: AdityaK | last post by:
Is there anyway I can get weekend date for a given date using DB2 query? I couldn't find any DB2 function that can be used to do so. Thanks, Aditya
1
by: ToysNTreasures | last post by:
Hi, I'm working on a class project in which I have to create a simple hotel reservation database using Access. I've created a couple of tables and queries that allow a user to determine room...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
4
mbolan77
by: mbolan77 | last post by:
Hello... I have a table with a number of fields along with a time stamp column... I am wondering how I can query for only rows inserted on the current date other than manually entering the date...
1
by: prateek | last post by:
Hi all using VB6 with Access how to prevent date enter before the current date. Please give me the syntax / code thanks
2
by: manontheedge | last post by:
I'm working on a program in VB6 and I need to be able to have the program display the current date ( actually, i just need the day number ), but I have no idea how to do this is VB...is there a built...
5
by: bruce24444 | last post by:
I have a database which assigns warranty claims to people with a main screen showing number of files assigned to each person. The number assigned shows day, week, month and year numbers so they can...
6
vikas1111
by: vikas1111 | last post by:
How to set date to current date...it should automatically update..
2
Soniad
by: Soniad | last post by:
Hi, In my website, I show commodity details on daily basis.These details are stored in one table for each day. I select record by matching current date and current date records are...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.