Full Version: Insert or select a date into a combo box
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
fritz
I'm trying to insert a date into a combo box using vba. The idea is to mimic a user clicking on the box and typing in a date.

Tried this, but nothing shows up in the combo:

CODE
Me.EventDatecmb = CDate(Me.Testtxt)


Is this even possible?

Harry
accesshawaii
Hawaii?...Woo Hoo. Used to live in Ewa, moved a few years back. Are you trying to generate a list in the combo box based off the entries?
fritz
I'm on the Big Island ... cold here today though (65 ... got down in the 50's last night, brr - has it gotten that warm this year by you ... grinhalo.gif)

QUOTE
Are you trying to generate a list in the combo box based off the entries?


not really. Have a list of event dates in the combo. If the user types in a date which doesn't exist, I have an add routine which allows the date to be added. Works fine.

Want to add the functionality of picking a date from a calendar. Using John Grove's pop-up calendar from here . (very slick, hats off to John!)

Clicking a date works as expected if I direct it to, say, a text box. But no go to a combo. Tried Me.EventDatecmb.column(1) and just got an object error.

Any suggestions?
H
accesshawaii
50's? I wish. I remember those days of complaining when it dropped below 70, now I'm ecstatic if it gets over 30.

Is the date field the first column in your combo box? If so, you need to refer to it as 0 for the column or you could just not refer to it at all. Another option would be to run an append query to the table that is used as the record source and then just requery the combo.
fritz
QUOTE
Is the date field the first column in your combo box? If so, you need to refer to it as 0 for the column or you could just not refer to it at all.


No, the date is the second column. So I tried the following as a test (date entered into a text box and then trying to assign it to the cmb - Object Required is the error

CODE
EventDatecmb.Column(1) = CDate(Me.Testtxt)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.