Selasa, 30 Oktober 2012

RE: [MS_AccessPros] Setting a default value in a date field in a form‏

 


John,

Thank you so much - it works perfectly!

Leatha Johnson

To: MS_Access_Professionals@yahoogroups.com
From: JohnV@msn.com
Date: Tue, 30 Oct 2012 18:16:48 +0100
Subject: Re: [MS_AccessPros] Setting a default value in a date field in a form‏

Dear leathamj47- (name?)

You can't do it that way. What you need is a bit of code in the

AfterUpdate event of both the combo box that selects the CompanyID and the

CheckOutDate:

Private Sub NameOfControl_AfterUpdate()

' Set the value for Due Date

Me.DueDate = Me.CheckOutDate + (Me.WeeksForStudentCheckout * 7)

End Sub

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications

SQL Queries for Mere Mortals

http://www.viescas.com/

(Paris, France)

-----Original Message-----

From: leathamj47 <leathaj@hotmail.com>

Reply-To: <MS_Access_Professionals@yahoogroups.com>

Date: Tuesday, October 30, 2012 6:00 PM

To: <MS_Access_Professionals@yahoogroups.com>

Subject: [MS_AccessPros] Setting a default value in a date field in a

form&#8207;

Access 2003

I have a database with a table (tblCompanyInformation) which stores data

that changes with each user. One of the fields in this table is

WeeksforStudentCheckout. The PK is CompanyID. I have another table,

tblStudentmaster, which contains the fields for a student order. It

contains CompanyID as an FK. I use a query which links these tables, and

serves as the basis for a student order form. One of the fields from

tblCompanyInformation is WeeksForStudentCheckout.

The student order form contains a control called CheckOutDate, which

defaults (correctly) to the current date. What I want to do is have

another control, duedate, have a default value of CheckOutDate +

([WeeksForStudentCheckout] * 7). When I enter this as the default value in

the form, and use the form to enter a new record, I get a blank in the

field. What am I doing wrong?

Tia for all help.

------------------------------------

Yahoo! Groups Links



[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar