473,657 Members | 2,566 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 CurentPromisedD ate
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 currentpromised ate 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 1801
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.Curre ntPromisedDate) Then
Me.CurrentPromi sedDate = 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.c om> wrote in message
news:55******** *************** **@posting.goog le.com...
I have set up two date fields in a table:

1stpromisedDate and CurentPromisedD ate
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 currentpromised ate 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
2886
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 MySql folder on drive C. However, when I'm in Dreamweaver I click on Applications at the side, and the plus button to add a MySql database. It tells me to enter 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 don't refer to de default property of a field, but the startvalues in the designenvironment of a table. I suppose that there is a sort of a designtemplate or a masterdatabase of a registry key with the startvalues.
2
2183
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 categories of information about each record - address information in one table, contact information in another table, order-related information in a third, and so on. The "Customer" table has an AutoNumber "Cust_ID" as a PK, which is the main...
10
2747
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 at -1 and 0 respectively. Unless I specifically set the table field's defaultvalue to Null, the form comes up with an automatic value of 0 in the control? The control has NO default value property setting. Why is that?
18
18359
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 a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
1
6476
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" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
4
2980
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 week. The main form has a combo box that must have a value selected before anything else can happen. Once that value is selected, the 7 subforms are enabled, and also one of the fields is populated with the value from the main form. These subforms also...
1
1692
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 the new entry in the master table. Each string possess its unique identifier number.
1
2113
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 for the user. In one of the subforms, I'm having a problem which is either a design or coding issue, I'm not sure which. I have a Customer table and a PhoneCustomer table so that I can link multiple phone numbers to a particular Customer. I want...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7321
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1607
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.