Apr 19 2006, 09:31 AM
I have a combo box on a form that lists every Thursday in 2006. Every Friday, the Thursday selected moves up one week. To make things easier for the user, I would like the combo box to default back to value last selected whenever the Form is opened. Does anyone know how to do that?
Apr 19 2006, 09:34 AM
In the After Updaste event put:
e.controlname.Default = Me.Controlname
Apr 19 2006, 09:49 AM
I am receiving an error message: Method or data member not found
Apr 19 2006, 10:11 AM
Ok, You need to use the wizards Access provides.
If you type Me. inthe VBE, you will get a list of all possible members of the Form collection. Included in that collection are all the controls on the form. From there you can select the controlname. After you select the controlname you press another dot and you will get a list of all the properties of that control. One of those properties will be Default or Default value or something like that.
No one here remembers every exact syntax or command. Since we volunteer our time here we don't always check to make sure our advice is syntactically correct. But we give you enough so you can figure it out. If you had typed out the commands as I show above you would have seen that Default may not have been the exact property.
Apr 19 2006, 10:24 AM
Thanks Scott. I typed in Me which brought up a list. I selected ctl3week (under the Other tab I have 3week, but that was not available) and default was not available, so I selected defaultvalue. It is still giving me an error; I'm baffled.
Apr 19 2006, 10:36 AM
It appears as though I may had my Other tab mislabeled since now it is actually changing the values. Strangely, it is now displaying times instead of the dates: 12:00:49 for example. The seconds change as I select different dates. Do you know what might be causing this?
Apr 19 2006, 10:44 AM
You are storing both data and time, you need to format the control to display Date, not Time.
Apr 19 2006, 10:59 AM
This is really really strange! Now, each time I select a value, it comes up 12/30/1899!!
Apr 19 2006, 11:36 AM
That means that there is no value being shown. A zero date value translates to 12/30/1899.
That is the RowSource and Bound column of the combo.
Apr 19 2006, 01:51 PM
The row source is a table called tblCurr3Week with one Date/Time field named 3-week start. This table lists the date of every Thursday in 2006. The combo box in the form is set up to select from this table.
Apr 19 2006, 02:28 PM
There is only ONE field in that table? Can you attach a stripped down copy of your database?
Apr 19 2006, 03:03 PM
Actually, there are dozens of tables in the DB so I just made a copy of the table and the Form into a new DB and zipped it up. Thanks so much for all your help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here