How to handle blank date and time?

I use MFC Visual C++ 4.2

I am developing a database application using MS Access 2000. 

The problem I am dealing with is how to handle if the user does not enter 
the date. There is a condition where they can do that for Finish Process Date 
/ Finish Process Time. 

I make the Date and Time as separate fields, both in the database and the 
application. On my application I use the COleDateTime data type.

I have to save the blank Date and the blank Time, and I also have to acquire 
them back in order to display the data using the CListCtrl.

What I am confusing is how to make the query?

Is it possible to make select * from <table1> where date1 = '' and time1 = 
'' ?

Or what should I do?

Thank you very much.
0
landon (165)
8/7/2008 6:58:00 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
926 Views

Similar Articles

[PageSpeed] 57

Could it be possible to you to add two fields to be used as boolean, like 
"BlankDate" and "BlankTime". So, if you are in the special condition of 
blank date or time, you can set these fields to true, and you can query like 
this:

   select * from <table> where BlankDate = true and BlankTime = true

(I don't recall if SQL has boolean type, if not you can use integer and 
assume true = 1 and false = 0)

Giovanni


"Landon" <Landon@discussions.microsoft.com> ha scritto nel messaggio 
news:CEDDA136-0381-48D7-8FCE-6085DE7A66E8@microsoft.com...
>I use MFC Visual C++ 4.2
>
> I am developing a database application using MS Access 2000.
>
> The problem I am dealing with is how to handle if the user does not enter
> the date. There is a condition where they can do that for Finish Process 
> Date
> / Finish Process Time.
>
> I make the Date and Time as separate fields, both in the database and the
> application. On my application I use the COleDateTime data type.
>
> I have to save the blank Date and the blank Time, and I also have to 
> acquire
> them back in order to display the data using the CListCtrl.
>
> What I am confusing is how to make the query?
>
> Is it possible to make select * from <table1> where date1 = '' and time1 =
> '' ?
>
> Or what should I do?
>
> Thank you very much. 


0
Giovanni
8/7/2008 7:28:42 AM
You can query using Is Null,

e.g. select * from table where date1 is null

HTH

Paul.
0
paul.ganney1 (118)
8/8/2008 8:55:42 AM
Reply:

Similar Artilces:

Macro to reveal three hidden rows each time it's clicked
Hi guys , Is it possible to create a macro which will reveal the next three hidden rows in excel every time a user clicks it? I've got a lot of hidden rows but I only want the next three to be displayed each time a user clicks the same button to activate the macro. I'd also like the cursor to then be placed in the first cell of the next three rows. Can you help? Many thanks, Keith Right click sheet tab>view code>insert this. Then DOUBLE click to fire Private Sub Worksheet_BeforeDoubleClick _ (ByVal Target As Range, Cancel As Boolean) For i = 1 To Cells(Rows.Count, 1).En...

Exchange 2K to 2K3 migration
I'd like to get some advice on the best approach to handle the STM file during an Inter-Org mailbox move. The Exchange migration wizard will handle the the mailbox but how do you handle the content in the STM file? Thanks. You don't need to worry about it. Mailbox data is stored in both the EDB and STM files. Typically, message content from the Internet will be in the STM file. I'd suspect that when you migrate the mailboxes, all data will be converted to native MAPI format (moved to EDB file) and will then be moved to the new mailbox. -- Ben Winzenz Exchange MVP Me...

Covert date to text
I have a mass of data with dates, which I need to group by DAY. I have formatted the cell to custom "dddd" so that it shows the day, however when i pivot report it still reads the date. How can i convert the date field to text to read the day? A straight forward format of cell returns the date in number format. HELP! "Alan" <anonymous@discussions.microsoft.com> wrote in message news:0bc301c3c642$ada1f740$a301280a@phx.gbl... > I have a mass of data with dates, which I need to group > by DAY. I have formatted the cell to custom "dddd" so > t...

=DATEDIF(start date,end date, unit)
When I use this function, the error #NAME? is returned. Could this because the function requires an ADD-IN or extra components installed? DATEDIF is described in my version of HELP but I notice it is not shown in the list of functions that appears when I select "Paste Function" from the toolbar and select the category "Date&Time". This is why I think perhaps the problem is that support is not installed. I'm using Excel 2000 V9.0.2720 Yes, tools>addins>analysis toolpak -- Don Guillett SalesAid Software donaldb@281.com "gvm" <postbox@tech...

arrived in appt time
I have a column A "appt start time" column B "appt finish time" column C "Arrival time" I need Col D to = Y or N if the arrival time was in the time slot. Columns a-c formatted dd/mm/yyyy hh:mm please can you help -- nigeo Hi, Try this =IF(AND(C2>=A2,C2<=B2),"Y","N") -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "nigeo" wrote: > I have a column A "appt start time" c...

Do Not Want to count blank Cells
I copy pasted an Access dynaset (e.g., results of a crosstab query) into an Excel spreadsheet. I tried to use the function =counta(a4:z4) to count the number of entries (nonblank) in row 4. But the result is giving me 26 because it is counting blank cells. Is there a way to count the entries without counting the blanks or a way to easily reformat or change the blank cells so the formula will not count the blanks. I do not want to have to manually delete every blank cell in a table 26 columns by 2000 rows. Thank you, Steve CountA does what you want. It seems that you must have s...

Handle to an ActiveX control
Hi... What if I use GetModuleHandle(L"abc.ocx") in the InitInstance() of the of the App class derived from 'COleControlModule'...of the ActiveX control "abc.ocx" ? Will I get the Handle or it will return NULL....? I have encountered controls, in some of them..handle is found and in others its NULL... Wat is the reason behind this behavior..? Can any one explain? "Abby++" <asthana.abhinav@gmail.com> wrote in message news:1174308443.062622.51500@b75g2000hsg.googlegroups.com... > What if I use GetModuleHandle(L"abc.ocx") in the InitI...

Automatically add date to email
I send many emails a day. I keep typing the date into each one. Is there a way to automatically add the date from the computer system. Thanks, ddlaz ...

MEET & DATE MORE LADIES EASILY (Proven) sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Sexually Attract Women Easily! with nature's secret weapon... Pheromones. It sexually stimulates women subconsciously. Whether you are looking for a friend, a date or a lover Just recently the pheromone Androstenone were reported on The Learning Channel (TLC) Feb 14 2001as being an effective pheromone for men to attract women Read the details right now for yourself. http://www.nymphosam.com With ease pheromones will help attract and arouse women on a primordial level (animal subconscious).Regardless of looks or social status, pheromones can help you attract more wom...

Charting Date Ranges
Trying to chart a series of date ranges (sort of in a timeline-typ fashion). Chart keeps showing beginning and end dates as two separat bars. I need them to span the entire year showing what amount of tim they take up. Where am I going wrong? Eni +---------------------------------------------------------------- | Attachment filename: chart1.jpg |Download attachment: http://www.excelforum.com/attachment.php?postid=366530 +---------------------------------------------------------------- ----------------------------------------------- ~~ Message ...

Extra (blank) browser window
Whenever I click on a link in an Outlook e-mail two Internet Explorer windows pop up. The first one is completely blank. The second one is the page I selected. This doesn't happen if I click on a shortcut or favorite. It started happening a few weeks ago. As I've tried to reconstruct the chain of events in my mind (which may be faulty), I started getting error messages when clicking on links from Outlook. A dialog popped up saying it could not find a file, and IE would not come up. Thinking Outlook had forgotten where the web iexplore.exe was, I pointed it to that lo...

date format problem #12
Hi, i have a problem. my userform has a text box that enters the date when used. my code is this: UserForm1.TxtQuoteDay.Text = (Date, "Long Date") the problem is, when the data is entered to my sheet, the date comes out like this: 09 May 2005// Everything is fine except for the //. Can this be removed or am i doing something wrong? the cell format is date 09 May 2005. Help appreciated. Regards, Nigel Did you mean something like: UserForm1.TxtQuoteDay.Text = Format(Date, "Long Date") And what does "when the data is entered to my sheet" mean? If it means...

copied info for chart does not show date correctly
I have Excel 2003 I have a chart that I copy over from month to month. It shows the date that data was turned in from several different units each month. the problem is that although I enter the correct date into the excel sheet, the date from the last month shows up on some of the units. but not on all! that is what seems so odd. I checked to see the correct dates were entered and checked the source/series to see it was referring to the column with the dates I entered. but on 4 of the units (there are 11 units in total) the date is from the month before.... Any ideas? Thanks, Meenie ...

Adding input to date
Hopefully the last time I will have to bug everyone! Within the BMP database I am working on, I am trying to find a way to calculate the next inspection date for each BMP, given the previous inspection date [tblBMP.InspDate] and the inspection period [tblBMP.InspPeriod] which is in years (e.g. a given BMP is inspected every 3 years). I've seen examples of simply adding a static value to the date, but how would I go about about using an input number and adding it to the year of the previous inspection date? Thanks again everyone! If all are in years then use the DateAdd function. Da...

blank To: field in Sent items
We recently migrated from Notes to Exchange and some of my users are complaining that some messages that they forward don't have an address in the To: field in Sent Items. We are using Outlook 2003. Any ideas? Same problem here. "Sander" <noemail@noemail.com> wrote in message news:<#7SnUBm0EHA.1564@TK2MSFTNGP09.phx.gbl>... > We recently migrated from Notes to Exchange and some of my users are > complaining that some messages that they forward don't have an address in > the To: field in Sent Items. We are using Outlook 2003. Any ideas? So are we...

Adding weekdays in a date formula
How would you add weekdays to a formula? ex. A1 = 1/1/10 If I want to add 80 WORKDAYS (excluding weekends), what formular would I use? =(A1+80) does't work... You were close to the name... =WORKDAY(A1,80) Note that you can add a third arguement to this function to define holidays, if desired. -- Best Regards, Luke M "Handy" <Handy@discussions.microsoft.com> wrote in message news:F73D7071-1877-4CAE-A17D-05EE0FDD02AC@microsoft.com... > How would you add weekdays to a formula? ex. > > A1 = 1/1/10 > > If I want to add 80 WORKDAYS...

Date Format #2
I have copied and pasted a word table into excel which was a pain in itself. The date format in word was Thu 21st June 2007. But the table would not sort into date order so I had to remove the "Thu" part. I then had to remove the paragraph sign as it was throwing extra cells in excel when I pasted it. Eventually the date went into excel but now I cannot format the date. When I look at the format 21st June 2007 it has defaulted to General under "format cell". When I change the format to say custome date it does not make a difference, the only way it shacges is if I man...

invalid handle
hi frds i m very new in vc++ and i m founding too much difficulty in this so plz can any one solve this problem .... actully i m inserting a image in list box using this code ........ everything is returning write thing still it is saying invalid handle after ImageList_Add(hList,m_hBmpNew,0); when i m going to dibug it plz help me BOOL Fun() { // Create 256 color image lists HIMAGELIST hList = ImageList_Create(32,32, ILC_COLOR8 , 8, 1); HBITMAP m_hBmpNew = (HBITMAP) LoadImage( AfxGetInstanceHandle(), // handle to instance "c:\\img.bmp", /...

Blank emails with no header?
Hi All, I'm randomly getting a few blank emails a day in my inbox with sizes of a couple hundred bytes. When I open them, I see nothing. If I save them to a file I get a zero length file (even though outlook shows the mail to be a few hundred bytes). Neither Norton nor NOD32 showed a virus (Outlook integration). The only header info is that the x-envelope is to me. There is no from, subject, or the usual info about the other mail servers mail goes through. Any ideas? Thanks, -=Gina Gina <G@no.mail> wrote: > I'm randomly getting a few blank emails a day in my inbox...

Thunking a 32-bit HANDLE to a 64-bit HANDLE
Currently I am converting a 32-bit WDM driver to a 64-bit KMDF driver that will continue to work with our 32-bit DLL and our customer's 32-bit applications. The sample code for thunking 32-bit items shows the following Buffer->Handle = (HANDLE)Buffer32->Handle; see: http://msdn.microsoft.com/en-us/library/aa489604.aspx Buffer32->Handle is declared as UINT32 Handle The driver compiler issues error number C4312 for this cast. The code that I have adopted (to get it to compile) is: handlerInputs.hEvent = (HANDLE) (ULONG_PTR) p_handlerInputs3...

DSum and date as criteria
Hello all, I am calculating a running sum within a query using the DSum function. DSum("[sngAmount]";"[tblAccountMovements]";"STR(CDBL([datDate]))<=" & Str(CDBL([datDate]))) sngAmount contains positve or negative numbers from the table "tblAccountMovements". "datDate" is a date field from the same table. I would like to calculate a running total within a query that is sorted by "datDate". Basically, the above formula works fine. However, there arise problems if datDate contains a date several times. If this is...

Max & date
I need to query the max of strRVSP that is also >40 (this is because there could be multiple values >40) and also have the corresponding date. I tried to do max across the board but it does not connect the max value with the correct date and if I just do max of strRVP it does not change the query. My table is tEcho and I need to include fields ingPtID, dtmDATE, strRVSP. My end result should be 1 max value >40 from field strRVSP with corresponding dtmDATE and ingPtID. Thanks! Note that strings and values behave differently as far as 'ordering' is concern...

Daily Bank Sweep
New GP Client that is reconciling for the first time their operating account. We have entered the last reconciled balance and dates as of 12/31/08. Operating account gets swept every night and redeposited the next day. With each sweep interest is calculated. My question is how to handle the last sweep of the month, which is a sweep in transit. We have tried entering as a decrease adjustment (not posting to GL as it should not effect the GL balance). We have also tried entering as an adjustment to see what the effect is. We don't even come close to the bank ending balance. Pl...

Number of hrs worked in a week, based on dates in a different column
Hi. I'm hoping someone will give this a try. I'd like to enter a function into each cell in column D so that the total hours worked for the previous week appears each Sunday. For instance, cell D6 would display 11, the sum of C2:C6 (note this is a short week). Cell D20 would display 22.5, the sum of C7:C20. On some days, no work at all is performed, but on other days multiple tasks are performed. The only cells in column D that should display a value are the Sunday's... all other cells should display nothing. Thanks very much for your help!! Gregg. ...

Handling blank data points
I have a chart which is has "" in a formula to clear contents when not applicable to show error. This results in the chart treating the cell as 0 and therefore ugly result in data point. All other post responses to this type of question suggest using NA() and conditional formation to hide the error.. Unfortunately when this is used this screws up my SUM() and AVG() formulas.. Any other suggestions? Thanks Jo Hi Jo, I don't know if this is the best way but what I have done under similar circumstances is use the #N/A for the chart series data column and then I use a hel...