Auto populate date in field based on selection in combo box

JStan89

Registered User.
Local time
Yesterday, 19:37
Joined
Jan 23, 2015
Messages
18
Hello all,

I'm creating a form that when the user selects the following categories in the same combo box (Date Received, Date Reviewed, Date kitted, In Work, Complete) it auto populates dates in the respective fields. As I mentioned, it's only one combo box. The dates will be spread out, so the user will change the combo box selection based on when these events occur. I already have a field for each category both on the table and form. Also, I do have multiple tables for other parts of data, but these categories all fall into the same table.

Any help would be much appreciated. Thanks!

If more detail is needed, I can give it, but if I get a general direction I think I can figure it out.
 
I forgot to mention, it would be the date the selection was chosen... So, Date()
 
Use the AfterUpdate event of the combo.
Code:
Me.Controls(Me.comboname) = Date
The text in the combo will need to exactly match the controlname on the form. You should also set the combo back to something meaningless with the OnCurrent Event so the user needs to choose every time a record is loaded.
 
Use the AfterUpdate event of the combo.
Code:
Me.Controls(Me.comboname) = Date
The text in the combo will need to exactly match the controlname on the form. You should also set the combo back to something meaningless with the OnCurrent Event so the user needs to choose every time a record is loaded.



Sorry, I'm still new to access. So, just to be clear, I put that code in the afterupdate on the combobox? How does that populate the dates in the respective fields?

Thanks in advance!
 
Maybe I'm not being clear enough on what I want. Here's a picture of my form interface. This might help. What ever option is chosen in "STATUS", it populates that day's date in one of the green choices depending on selection.

Again, I'm still a little fuzzy where/how the code you provided me works.
 

Attachments

  • Untitled.png
    Untitled.png
    23.4 KB · Views: 179
How does it know which control to put the date in?
 
How does it know which control to put the date in?

Based off the selection that was made in combo box. For instance, if the user chooses "Full Kitted" in combo box, it would add that day's date to "Date Kitted" field. When user changes to "In Work" in combo box, that day's date is added to Mfg.Start Date field. Does that make sense?
 
It would seem that some textboxes are populated from more than one selection of the combo as there is not a one to one correspondence. Set up the combo with two columns. One that displays as it does now the other with the name of the textbox that is to be updated. Hide this second column by using the ColumnWidths Property. Then the AfterUpdate code will be:
Code:
Me.Controls(Me.Status.Column(1)) = Date
(Assuming the combo is called Status.)
 
BTW I probably would not do it this way at all. I would be more inclined to have a related table with a single date field and another field that indicates which type of date is being recorded. This structure is much simpler to query.
 

Users who are viewing this thread

Back
Top Bottom