Connecting Tech Pros Worldwide Forums | Help | Site Map

DTPicker problem.. need help here

Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#1: Dec 29 '08
Hello everyone..

I need some help here... i m using VB6 and SQLServer2000... i have forms regarding some cases in courts and in my form i have two DTPicker called as Entrydate and Closedate... these 2 are invisible to the user bt the things is when a user create a new case in a system automatically the date has to be created as a current date by default in DTPentrydate and when the user close the case the date has to be closed automatically as a current date by default..
i have no idea wht i have to do?
wld u plz help me
thank u very much

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#2: Dec 29 '08

re: DTPicker problem.. need help here


Then you do not need the controls at all. You need to use system date.
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#3: Dec 29 '08

re: DTPicker problem.. need help here


i m using the system date.. i have already set the system date wit tht.. the thing i dont knw how to do set the date when the case gets open and how to set the date when the case get closed and tht also has to be automatically.. tht i dont knw... already the date is set as default bt both the date comes same as the current date by default..
can u help me with the code.. i have no idea
thankx
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#4: Dec 29 '08

re: DTPicker problem.. need help here


is it such that your case open date and case close date are one and same ?
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#5: Dec 29 '08

re: DTPicker problem.. need help here


now is coming the same bt i dont want them same... coz may be the case is open month or more and after tht it wil get closed...
how can i set the dtpentrydate and dtpclosedate to the opening a case and closing a case...
plz help me in tht
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#6: Dec 29 '08

re: DTPicker problem.. need help here


1.when you open a case accept the system date as opening date.

2.do the same for closing date also.

in that way you do not need the DTPicker controls.
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#7: Dec 29 '08

re: DTPicker problem.. need help here


i have to column in my casemaster table as entry date and closedate...
so when they come to the add mode to add a new case to the system i have to accept the date thr.. this is wht u mean... rit???
can u help me wit the code sample plz
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#8: Dec 29 '08

re: DTPicker problem.. need help here


i have this code in my add mode

DTPentrydt.Value = Date
DTPclosedt.Value = Date

bt both the date is coming same
how can i chage this and set them to the opening the case and closing the case date??
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#9: Dec 29 '08

re: DTPicker problem.. need help here


are you opening and closing the mcase on the same form ?

how can you enter the closing date at the time of opening the case ?
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#10: Dec 29 '08

re: DTPicker problem.. need help here


ya opening and closing on the same form... actually in the beginning they suppose to enter the date for the entering and closing date and thts why i used the dtpicker for tht.. bt then they said tht has to be invisible to the user and make it system date.. for opening i can do it in the add mode and enter the system date as a default when the add the new case.. bt for closing date i dont knw wht should i do... and u r telling me not to use dtpicker and i dont knw wht to use instead of tht and how to use..
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#11: Dec 29 '08

re: DTPicker problem.. need help here


can you tell me what is the logic to decide the closing date ?

how you know when the case will be closed ? is that pre-decided ?

any link with opening date ?
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#12: Dec 29 '08

re: DTPicker problem.. need help here


this is abt some cases in the court and never can be pre-decided when the case get closed.. coz it may take one day to get close or one month to get close... thts why i have no idea how to do for the closing date... i have to set something for a closing date of the case.... thr r 2 columns on my master table as entry and close date and tht i m showing in the grid on the form... when the add the case the entry wil get the current date and wil enter to the grid bt the close date wil be empty... bt when the got the result from the court and the case get closed the problem comes.. coz i dont knw how to put tht date in the database and the gird both..
i hope u understand wht i mean :)
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#13: Dec 29 '08

re: DTPicker problem.. need help here


the following might help you

1.at the time of opening a case enter only the opening day (closing date as null).
2.use a separate form to close all the open cases (accept the system date here as closing date).
3.at the time of closing update the table with closing date.
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#14: Dec 29 '08

re: DTPicker problem.. need help here


ok.. tht is very good idea i can do tht...
bt can i make a button as a final on the same form and by clicking on the button the case gets close and set the close date in the button?? if i want to do tht can i put this line in the click event of the button

DTPclosedt.Value = Date

and wht shld i put as an update of my gird in the click event of button???
sorry for troubling u
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,508
#15: Dec 29 '08

re: DTPicker problem.. need help here


it is always better to close the cases on a separate form.
you need to update the close date in the database table not the grid, after that you can refresh the recordset that is populating the grid to display the changed records with cloging date.
Newbie
 
Join Date: Dec 2008
Posts: 3
#16: Dec 29 '08

re: DTPicker problem.. need help here


I am assuming that if you are using sql you are selecting the case from the database. I also assume that the database will have an open and close date for the case. In setting the current date and null for close date when creating the case for the first time. Then use the update command to update the sql database with the information needed. Then when select the case to close it use the current date and just update the close date in the database using the update command again. If that isn't it then we need to know where the data is being retrieved from/or stored and how you are getting the information into your VB program
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#17: Dec 29 '08

re: DTPicker problem.. need help here


Thank u very much to all.... it helped me a lot
the way u told me to do its the best way and wil do tht way
Reply