update after lost focus

jalverson

Registered User.
Local time
Today, 15:41
Joined
Oct 27, 2004
Messages
42
I have a form with a combo box for the user to select a specific date. I need to update the date field after the combo box loses focus instead of on the change of a record.

Can someone provide me the vb code that will update the field when the focus is lost?

Thanks for your help,

Jeff
 
In the AfterUpdate event of the ComboBox put:
Me.DateFieldName = Me.ComboBoxName.Column(1)

Zero based so that column(1) is the 2nd column of the cbo and Column(0) is the 1st, etc.
 
Thanks for the response. I pasted your code as directed into my database. I replaced your code with the following fields.

Me.EFFECTIVE_DATE = Me.Combo70.Column(13)

The combo box still has a drop down list to select from but doesn't display any date or store any date when a date is selected.

What am I doing wrong? Thanks for your help.

Jeff
 
How many columns does your ComboBox have? Not rows but columns wide? You can not reference more than the number of columns detailed in the Column Count property of the Format tab of the property sheet for the ComboBox. You are trying to get to the 14th column.
 
Ok, the column count is 1, I used the tab index which was 13. Changing the value didn't work. Let me back up and describe what I'm trying to do.

I'm creating a form based on a query that allows the user to select a date and then the form displays the shipping rates and does some freight calculations. In the query, I have the freight table joined by the effective date and the vendor ID. What I need to happen is when the date is selected from the combo box, the effective date field would be populated which would allow the query join to pull the correct data from the freight table.

I welcome other suggestions on how to handle this. I need to store the date selected so it can be displayed on a report at a later time.

Again, thanks for your help,

Jeff
 
Well you will need something like this:
Me.EFFECTIVE_DATE = Me.Combo70.Column(0)
in the AfterUpdate event of Combo70 but you will probably also need a
Me.Requery. Try that while I give your current design some thought. What sort od dates do you have in the ComboBox? Are they strings?

Have you considered a DatePicker for the date selection? Is this a shipping date or something?
 
Last edited:
Awesome. I think the requery was the trick to make it work. Once I got the column count correct and used the requery, the form works as it was designed.

Thanks for your help!

Jeff
 

Users who are viewing this thread

Back
Top Bottom