How to set the default value (date today) of a listbox

rheeyum

Registered User.
Local time
Tomorrow, 00:45
Joined
Feb 2, 2010
Messages
35
I've got stuck to this problem in access wherein I cannot set the default value of a listbox to the date today. I am currently making an AHT (Average Handling Time) in access but seem to have no luck. In excel, I know how to make it but not in access (please see sample AHT in excel) I know how to automatically set the value to the date today whenever I add entries to the datasheet table as well but I don't want it added automatically; I want users to manually add the date today by using the dropdown list and then choose the date today displayed on it. Will also want to apply this to time so that time now is manually added and not set to default. I appreciate any help that you can offer me.

OTHER INFOS:

I am using a datasheet form as an AHT tracker so that users don't see much difference compared to excel.

PRELIMINARY ACTIONS TO NO AVAIL:
I made 2 tables. One was for the AHT tracker and the other as a look up table to the date field of my AHT tracker. I then set the default property of table 2 to Date() then reference it to the AHT tracker's look up table. Now when I try to use the list box in my AHT tracker for the date field, date today is not diplayed.
 

Attachments

I've found a temporary solution by pressing CTRL + ; for date today or CTRL + : for time now but I don't find it user friendly... It works best if I could use the dropdown button and have the time or date today. It is easier for users that way because some users may not even know the key combinations to make... Although I put a status bar text text showing what to do with the column, still, I find the dropdown list easier.
 
I haven't yet looked at your db but you need vba to accomplish this. A command button labelled "Today's Date/Time" which when clicked will extract the time and date from the DATE() function and automatically fill the textboxes. This is how:
Code:
Textbox1.value = Date()
Textbox2.value = TimeValue(Now())
Textbox1 will contain today's date and textbox2 will contain the current time. You will put that sort of code in the CLICK event of your button.

However, why do you want your users to ALWAYS enter today's date and time if you can do it automatically?

Welcome to AWF by the way :)
 
Tnx vbaInet! However, I am using a datasheet tracker on a form that works much like an excel spreadsheet. The reason for this is that I dont want users to feel much like difference between access and excel. Also, it allows multiple updates and let's you see a wide array of data. Not sure if I can use a command button because it will make the datasheet tracker much more complicated.

With regards to the reason why I want users to manually add the date and time through a listbox was that my users does not immediately update the fields after an entry was added. They do it after couple of hours after an entry was added. And since we are dealing with average handling time, I want to be accurate up to the last minute. Also, I have 3 important columns like Start, End and AHT. The Start column should record the time it was updated and the end column to record the end of time it took. The AHT column then computes the difference between the 2 first columns mentioned so that we comeout with the number of minutes they worked on a specific entry.
 
I have another temporary solution but I still haven't hit the right thing... Whewww... This thing really makes me sick... I tried to change the event property of the textbos so that whenever it was double clicked, the date and time will appear. However, this is not exactly what I want to do. I want to be able to utilize the dropdown list so that when it was clicked, the date and time will display and recorded on the field. Works much like a validation list on excel.
 
Tnx vbaInet! However, I am using a datasheet tracker on a form that works much like an excel spreadsheet. The reason for this is that I dont want users to feel much like difference between access and excel. Also, it allows multiple updates and let's you see a wide array of data. Not sure if I can use a command button because it will make the datasheet tracker much more complicated.
What about the double-click event? What was the outcome?

With regards to the reason why I want users to manually add the date and time through a listbox was that my users does not immediately update the fields after an entry was added. They do it after couple of hours after an entry was added. And since we are dealing with average handling time, I want to be accurate up to the last minute. Also, I have 3 important columns like Start, End and AHT. The Start column should record the time it was updated and the end column to record the end of time it took. The AHT column then computes the difference between the 2 first columns mentioned so that we comeout with the number of minutes they worked on a specific entry.
You could add some code in the Before_Update event of the FORM to check if a value has been entered in either of the text boxes, if it has then it should set the text box's date/time values.
 
What about the double-click event? What was the outcome?

The double click event will display the date and time when clicked twice. The reason why I set that to double was that I want to minimize so much changes whenever the cells in the datasheet were clicked. I am not sure if the Before_update event will make the listbox work so that when it was clicked, it will display the time and date. If you could open my attachment AHT, you will see how it looks like in excel. Well my form looks like an excel datasheet it's just that the listbox wont display the date and time.
 
I think I now understand your predicament. I believe you're using a Combo box, not a list box. Here's how:
Code:
Combobox1.Rowsource = Now()
Put that on the GOT_FOCUS event of the combo box.
 
waaahhhhh!!!!!!!!!!!!!!!!!! Ur the bomb!!!!!!! I got it! I got it! ehehehe, thanks vbaInet! I never thought it would be that fast!!!!!! Now I know... I had to try that several times before I have done it perfectly. I was overwhelmed with the rowsource code that I forgot to change the row source type and so there were errors... ahahaha, fortunately I saw that row and change to value list.. Now I had it working perfectly... wheewww!!!!!!! thanks man!!!!!!!!!!!!! now im loving this forum very much!!!!!!
 
waaahhhhh!!!!!!!!!!!!!!!!!! Ur the bomb!!!!!!! I got it! I got it! ehehehe, thanks vbaInet! I never thought it would be that fast!!!!!! Now I know... I had to try that several times before I have done it perfectly. I was overwhelmed with the rowsource code that I forgot to change the row source type and so there were errors... ahahaha, fortunately I saw that row and change to value list.. Now I had it working perfectly... wheewww!!!!!!! thanks man!!!!!!!!!!!!! now im loving this forum very much!!!!!!
Haha!! sounds like that has been a pain in the backside for a long while.

Glad it's all sorted now. You're welcome!
 

Users who are viewing this thread

Back
Top Bottom