I want my "requalify date" to auto populate to the beginning of the month in the following year when my "liability date" gets entered/changed.
Example: Liablity date = 11/15/2010; 7/31/2011
Requalify date should be 11/1/2011; 7/1/2012
I am not sure how to write the formula to get this result.
The requalify date is a field in my main table as well as the liability date. When entering the formula, would entering it in the requalify date field's default value be the best.
Any help would be much appreciated. Thank you!
Yappy
9 8893
Try using DateSerial(year, month, day) combined with DatePart(interval, date) to build your formula. The formula for requalify date can be:
DateSerial(DatePart("y",[Liability Date])+1,DatePart("m",[Liability Date]),1))
Sorry, that should be:
DateSerial(DatePart("yyyy",[Liability Date])+1,DatePart("m",[Liability Date]),1)
Hi, Steven!
Thanks for your reply. I do have another question since I am not sure if I am placing the expression in the correct area.
When entering the formula, would entering it in the requalify date field's default value be the best?
I have tried that and am getting errors.
It could go in a query as a calculated field, or as the control source on the form.
Using it as a default value wouldn't work, as you've found out.
Did you want the value to be editable, or always based on a calculation? If you want it to be initially calculated after the liability date is entered, and then to be able to edit it after, you'd need to use VBA.
The code would be something like this: - Private Sub Liability_Date_AfterUpdate()
-
If IsDate([Liability Date]) Then
-
[Requalify Date] = DateSerial(DatePart("yyyy", [Liability Date]) + 1, DatePart("m", [Liability Date]), 1)
-
End If
-
End Sub
-
NeoPa 32,556
Recognized Expert Moderator MVP
You will find it complicated to keep updating the value. Not impossible, but complicated.
This is not something you should really even be considering (See Normalisation and Table structures). A normalised database would calculate the related value as and when needed, but never store a value that can always be calculated reliably.
I agree: if the value can always be calculated then it should not be a field in your table. If that's the case, add Requalify Date as a calculated field in a query. The exception would be if the database is for Access 2010, which supports calculated fields in tables.
The field in the query would be something like: - Requalify Date: DateSerial(DatePart("yyyy", [Liability Date]) + 1, DatePart("m", [Liability Date]), 1)
Thank you so much! That is exactly what I needed. I tested it and it works perfectly.
NeoPa 32,556
Recognized Expert Moderator MVP
Steven,
you may want to check your PMs :)
Hi NeoPa,
I'll be sure to include code in the [code] tags.
I'm unable to reply (regarding changing my status to Expert) with a PM. I haven't sent any, but I get the message:
Registered members under 50 posts can only send 3 private messages a day.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: pb648174 |
last post by:
I have a table called BidItem which has another table called
BidAddendum related to it by foreign key. I have another table called
BidFolder which is related to both BidItem and BidAddendum, based...
|
by: jochen scheire |
last post by:
Is there a way I can calculate a field in a form based on another field in
the same form. When clicking submit, both values should be posted to the
next page. I want to be able to type in a value...
|
by: pkinville |
last post by:
ok, this is gonna seem stupid, but it has been stumping me all
afternoon.
I have two fields on a HTML page. HTML looks like this...
<html>
<head>
<title>New Page 3</title>
</head>
<body>
|
by: Mike |
last post by:
I'm sure this has been covered before in the newsgroup but have had no
luck locating it.
I have two tables: InstMonitors & MonModDesc
Structure of MonModDesc:
Model, Description
Structure...
|
by: rmputnam |
last post by:
I have a new patient table (PatTbl) that lists Acct, Last, First, among other fields. I need another table listing referring information (RefTbl).
My goal is to enter the Acct number in the...
| |
by: Neha Jain |
last post by:
i have a table 'Tab1' with some fields. i want to create a screen consisting one of the fields in Table 'Tab1'.user must be able to select any of the data stored in the table for that field and any...
|
by: kpfunf |
last post by:
I have one table of transactions, another table of price quotes. Transactions are nearly daily; quotes are periodic, roughly once per week. In a query, I want to pull the oldest (or least date)...
|
by: Ronald |
last post by:
I hope somebody can help. I can't get into the specifics of my
project, but I'll try to create a simple example:
tblVehicle
* VIN (text box)
* Make (text box)
* Model (text box)
frmRepair
|
by: dkyadav80 |
last post by:
<html>
///
here what shoud be java script for:
->when script run then not display all input text field only display selection field.
->when user select other value for institute only this...
|
by: Cron |
last post by:
Hi I'm trying to Dcount *unique* records by comparing a date/time
field. I say *unique* because the field contains a date/time but I
need to ignore the timestamp and work off the date only.
I...
|
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...
| |
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...
|
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,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |