Hi
I have used three combo box in VB 6 form one for selecting date one for month and one for year. If the selection is say 12/07/2007 then I need it to be converted as 12/07/2007 under one field i.e date field of access database. So how can I do this.
For ref. combo1 is for date,combo2 is for month and combo3 is for year
and date is the field in database
table name is mm
database name is nn
Will any one help me by writing the necessary code.

(K.S.)

instead of using 3 combo boxes use DTPicker control and then find out the .Date .Month .year property of the control.

Hi
I have used three combo box in VB 6 form one for selecting date one for month and one for year. If the selection is say 12/07/2007 then I need it to be converted as 12/07/2007 under one field i.e date field of access database. So how can I do this.
For ref. combo1 is for date,combo2 is for month and combo3 is for year
and date is the field in database
table name is mm
database name is nn
Will any one help me by writing the necessary code.

(K.S.)

You are using three combo box means three text fields.
Take three strings. Likewise strday = cmbday.text , strmonth = cmbmonth.text , stryear = cmbyear.text and While inserting in the database use this

(to_date('" & strday & "','dd-mm-yyyy') & to_date('" & strmonth & "','dd-mm-yyyy') & ('" & stryear & "','dd-mm-yyyy')

Try this in your inserting query and you have to try it.

Try this.

Dim myDate as Date
Dim mth as String
Dim day as String
Dim yr as String
.
.
.
myDate = CDate(mth & "/" & day & "/" & yr)

I used the following code as a trial but it did not work.

Private Sub Command1_Click()
Dim a, b, c As String
Dim d As Date
d = CDate(text1.Text)
a = Combo1.Text
b = Combo2.Text
c = Combo3.Text
d=('" & a & "','dd-mm-yyyy') & to_date('" & b & "','dd-mm-yyyy') & ('" & c & "','dd-mm-yyyy')


End Sub

Hi
my intention is to make date month year selection as that of IRCTC (railway ticket booking site) There you have to select date month year in different combo box.
Hence any idea

I think that dbasisdas' suggestion is the simplest solution, however I've found datepickers to be pretty slow. Slow enough to be annoying.

Hoppy

This question has already been answered. Start a new discussion instead.