Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dblookup calander ?????? is it possible

Status
Not open for further replies.

neveragain

Programmer
Jun 4, 2003
1
US
hey guys can you help me out plz
rather than using a list/combobox is it possible to use a calender to lookup?
and if not
can you create new entries using dblookupcombobox or do you need the dbnavigator?
 
You can combine the TDateTimePicker component with a date field in a database.

Necessary: Of course a database with a date field
2) a Form
3) a TdateTimepicker Component
4) a Tquery or Ttable
5) a Tdatasource componenent
6) optional a TdbNavigator

In my case I have a Date field ShiftDate in my query

Events to be programmed

onDataChange, onUpdateData (datasource)

onClick (DateTimepicker)



This syncronizes the datetimepicker with the database
procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
begin
inherited;
DateTimePicker1.Date := Query1SHIFTDATE.Value;
end;


This syncronizes the database with the datetimepicker

procedure TForm1.DataSource1UpdateData(Sender: TObject);
begin
inherited;
Query1SHIFTDATE.Value; := DateTimePicker1.Date;
end;


When a date is entered this exported to the database

procedure TForm1.DateTimePicker1Click(Sender: TObject);
begin
inherited;
//disconnect handler
DataSource1.OnDataChange := nil;
// set query in edit mode
Query1.Edit;
//reconnect handler
DataSource1.OnDataChange := DataSource1DataChange;
end;


Regards

S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top