CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 Setting date/time field according to listbox value

Print topic Send  topic

Author Message
manfre

Posts: 4
Posted: 05/09/2008, 6:28 AM

Any help would be appreciated -

I'm trying to set a date/time control to NULL only IF the user_id listbox field is NULL. I would like to perform this once a user clicks the 'submit' button.
View profile  Send private message
DaveSause

Posts: 14
Posted: 05/09/2008, 1:04 PM

Use a before insert or a before update event.

If flduser_id is null then



_________________
Dave Sause
View profile  Send private message
DaveSause

Posts: 14
Posted: 05/09/2008, 1:04 PM

Use a before insert or a before update event.

If flduser_id is null then
flddatetime = null
end if

this will take a little effort in the datebase, I found I had to put default values in the database and deal with a lot of syntax issues where it was difficult to get CC to tell me what was going on. For example if user_id is text, is it truly null, equal to null string ("") or equal to a space (" ") - any of the three are possible, so you have to identify which is happening. Is it syntacially correct to say datetime = null in your database? Access accepts this, but then sets it to something line 00/00/0000 12:00:01 within the datebase.

I had cases where I made the default 1/27/1948 11:00:00 (my birthday) so it was locateable, but not out of bounds for date and time functions. The big thing is the test must find what you consider a blank user_id and then set the date/time to what you define as a null value. On output, you can always convert 1/27/1948 to something like "NO INFORMATION" to highlight no input, or exclude values or whatever.

Dave


_________________
Dave Sause
View profile  Send private message
manfre

Posts: 4
Posted: 05/12/2008, 10:32 AM

Thanks Dave for your reply.
Probably easier to give you some details of the project:

I created a simple MS Access DB to track PC Ownership - users can signout machines for use and selecting their name and entering an expiration date for how long they need the machine.

When a user signs in a machine, the change the USER_ID list box to value 'sign-in' (use to be 'select value', so basically setting USER_ID to null).

My goal was to set the SIGNOUT_TO field to NULL if USED_ID was was set to 'sign-in' (NULL).


I'm using an Access DB, and I created an update query to test before using in CC. Here is my update query:

UPDATE SYSTEMS SET SYSTEMS.SIGNOUT_TO = Null
WHERE (((SYSTEMS.USER_ID) Is Null));


This works great through Access, but my question is how/where do I used this in CC? I'm new to using CC and I'm not sure where this SQL query would go.

I have CC to use ASP..not sure if this info helps.
View profile  Send private message
manfre

Posts: 4
Posted: 05/12/2008, 11:06 AM

Had another question, but forget to mention - one a different CC topic, is there a way to display a 'disabled' listbox value a different color? I need to use the listbox but I would like the text listed in the disabled listbox to be black instead of the greyed out color. Thanks!
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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