Access listboxes - format datetime values

L

Lak

Hi all,
I am displaying a bound listbox in a form. One of the columns of this
listbox displays a datetime value. This dateTime value needs to be formatted
and shown in military time format.

In the rowsource property of the listbox, I am specifying an Access query.
The Access query formats the datetime value using the function Format(input,
"mm/dd/yyyy hh:mm")

The problem is when I scroll the listbox, the datetime column becomes null
sometimes. I don't know why this happens. If I don't format the datetime
value, then the problem does not occur.

Any help is appreciated.
Thanks.

-Lak.
 
K

Ken Snell \(MVP\)

My guess is that the data in that field for those records is not properly a
date/time value that ACCESS can recognize. Look at the original data in the
table for those particular records and see if the data are valid. Also look
at the query that you're using for the listbox's Row Source and see if the
values show as "null" in the query or not.
 
L

Lak

Thanks for your reply Ken. I will check what the query is returning. However,
all rows in the listbox go null for this particular column. This happens when
I scroll to the second page of the listbox, open a different form and come
back to the form which contains the listbox. Please share your valuable
insights.
-Lak.
 

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