473,406 Members | 2,273 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,406 software developers and data experts.

Calculating a default date on an input form

I am a relative novice with Access and I am developing an input form that I need a default date to populate, regardless of the input date e.g. If I input data on Tuesday, Sept 27, I want the default date to be the previous Saturday, Sept 23 or if I enter data on Friday, Sept 29, the default date should also be Saturday, Sept 23. Is there a way to do this with date math, since the input date could be any date from the 23rd through the 29th. This needs to happen for any date entered, to find the previous Saturday. Is this even possible?
Sep 26 '06 #1
3 2361
PEB
1,418 Expert 1GB
You need your default date to be based on the last Saturday?

It is possible by writing code in VB in your on load Form property event!

Do you want to continue with the code?
Sep 27 '06 #2
You need your default date to be based on the last Saturday?

It is possible by writing code in VB in your on load Form property event!

Do you want to continue with the code?
I've been experimenting using VBA, which I'm finding has many more options then point and click, obviously! I'm just not sure of the logic necessary to make it look back to the previous Saturday, regardless of what day it is, unless of course, the day the record is entered is a Saturday.

Any help pointing me in the right direction to accomplish this would be greatly appreciated!

David
Sep 27 '06 #3
PEB
1,418 Expert 1GB
So my frien,

See this expression:

CVDATE("29/09/2006")-(DatePart("w", CVDATE("29/09/2006"),vbSaturday)-1)

it returns the last saturday!

So instaed 29/09/2006 you need to place your date!

:)
Sep 30 '06 #4

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

Similar topics

6
by: cover | last post by:
Anyone know how to enter the time into a form or a website that might tell how? I'm using the following html code and trying to get the time to default into the text box. thanks html code...
4
by: Ragnar Heil | last post by:
I have got a form where I offer a default date (01.01.2004) and visitors can change it and make queries in the database. After changing this, the customized date should be displayed in the form...
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
11
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
5
by: keith | last post by:
This may seem simple, but I'm having a bit of trouble figuring out exactly how to do it. I'm accessing a database through an ODBC link, and I have a query that returns only jobs completed that day...
4
by: Yotam | last post by:
Hi, I need some help with JS. I will be grateful, if you can help me out. I have two date fields (check in, check out) and "number of days" field. I want the script to calculate automatically...
8
by: =?Utf-8?B?QWw=?= | last post by:
I am working in vb2005. how can I calculate business days (not including holidays and weekends) between 2 dates? thanks Al
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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.