CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 default to a period based on present date

Print topic Send  topic

Author Message
charles
Posted: 08/17/2005, 6:18 AM

Hi,
I have a table of accounting periods with the following fields
period_id
period_description
date_from
date_to
I know how to write the query that can select the period based on the currentdate....ie
select period_id from period
where getdate() between period.date_from and period.date_to
My question is how do i make a listbox based on the period table default to the value of this database expression.
Regards,
charles
Edd


Posts: 547
Posted: 08/20/2005, 9:26 PM

In the default value of the Listbox put in the name of a function, eg. GetCurrentPeriod()

Then in the Event coding, outside ALL other functions created the function,

function GetCurrentPeriod()
GetCurrentPeriod = CCDlookup("period_id", "accounting_periods","getdate() between date_from and date_to, DBNameodDB)
End function

Issues that you MIGHT encounter,
1. The value getdate is a DATETIME, therefore your to date must be populated with a TIME expiring at 11:59:59
2. The DBNameodDB may not be active, therefore instantiate the database class, eg.

function GetCurrentPeriod()
Dim DBConn
Set DBConn = new clsDBNameodDB
DBCOnn.Open
GetCurrentPeriod = CCDlookup("period_id", "accounting_periods","getdate() between date_from and date_to, DBConn)
DBConn.Close
Set DBConn = Nothing
end function


Hope than helps
Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.