473,507 Members | 6,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting Default Value in Table Design for use in subforms

I have set up two date fields in a table:

1stpromisedDate and CurentPromisedDate
The first field is to record the 1st promised delivery date of a
supplier and the second is to record the current promised ate from a
supplier. In an ideal world these two dates will always be the same,
but in reality the delivery date will change. Therefore I want to set
the currentpromisedate to default to the 1stPromiseDate value. I need
to be able to overwrite the default value as and when the delivery
date changes.

How do I do this?
Nov 13 '05 #1
2 1783
Can't do that at the Table level, but in your form you can use the
AfterUpdate event of the first field to assign a value to the 2nd if no
value has been assigned:

Private Sub 1stpromisedDate_AfterUpdate()
If IsNull(Me.CurrentPromisedDate) Then
Me.CurrentPromisedDate = Me.[1stpromisedDate]
End If
End Sub

It might be better to use a Number field for the current one instead of a
date. It would contain the number of days different from the original date:
negative if early, zero if the same, positive if delayed. This field would
default to zero. To show the actual current promised date, you would then
use:
DateAdd("d",, [DelayDays], [1stpromisedDate])
This structure avoids the issue of the dependency between the two in the way
the data is stored.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"hyphen" <p4**@hotmail.com> wrote in message
news:55*************************@posting.google.co m...
I have set up two date fields in a table:

1stpromisedDate and CurentPromisedDate
The first field is to record the 1st promised delivery date of a
supplier and the second is to record the current promised ate from a
supplier. In an ideal world these two dates will always be the same,
but in reality the delivery date will change. Therefore I want to set
the currentpromisedate to default to the 1stPromiseDate value. I need
to be able to overwrite the default value as and when the delivery
date changes.

How do I do this?

Nov 13 '05 #2


Thanks - that works a treat!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

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

Similar topics

16
2867
by: John | last post by:
Hello. If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the...
3
311
by: Jan Vente | last post by:
Dear listmembers, Is it possible to change default values in the table design view. for example: De default value for the fieldsize of a textfield is 50. Could I change that value by default. I...
2
2170
by: deko | last post by:
This may be an easy question, but for some reason the multiple table design idea is throwing me. I'm trying to avoid using one large, wide table - so I've got multiple tables that hold different...
10
2718
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
18
18304
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
1
6441
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
4
2969
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
1
1681
by: SirTKC | last post by:
Hi, Here is the following scenario. I do have a master table with related subforms from wich I need to create a revision. But I need to duplicate the content of the subforms and link them to...
1
2106
by: Rathman | last post by:
Hi, I'm trying to create a general form with multiple subforms. The subforms contain discrete pieces of information such as Customer, Work Order, etc, while the main form is simply a front-end...
0
7314
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
7372
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
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
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,...
1
5041
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...
0
4702
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.