Preselect combo box value

P

Pendragon

Access03/WinXP

In the After Update property of a combo box, I am calculating the next
available time slot and writing that value to a text box. I would like the
combo box of the time intervals (which the user selects) to be pre-selected
to the calculated time.

After Update property:

Dim vNextTime As Date
Dim vDuration As Long

vNextTime = DLookup("MaxOfMatchTime", "qryMaxMatchTimeSub")
vDuration = Me.cboMatchFormat.Column(2)

vNextTime = DateAdd("n", vDuration, vNextTime)
Me.txtNextMatchTime = Format(vNextTime, "h\:nn ampm")

Me.cboMatchTime.Value = Format(vNextTime, "h\:nn ampm")

For the last line, I have tried setting Me.cboMatchTime and
Me.cboMatchTime.value equal to vNextTime as well as what you see above.

qryMaxMatchTimeSub has the following SQL:

SELECT Max(T_Match.MatchTimeID) AS MaxOfMatchTimeID,
Max(adm_MatchTimes.MatchTime) AS MaxOfMatchTime
FROM T_Match INNER JOIN adm_MatchTimes ON T_Match.MatchTimeID =
adm_MatchTimes.MatchTimeID
GROUP BY T_Match.TournID, T_Match.CourtID
HAVING (((T_Match.TournID)=[forms]![frmT_ScheduleOfficials].[txtTournID])
AND ((T_Match.CourtID)=[forms]![frmT_ScheduleOfficials].[cboCourt]));


The appropriate calculated value displays just fine in the text box.
However, there is no pre-selection taking place in the combo box; it remains
blank (though values do exist for selection when clicking on the drop down).

I haven't done much with time and time formats, just dates, and this has
been problematic. Suggestions?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top