on change event runs a query

DenisCooper

Registered User.
Local time
Yesterday, 20:54
Joined
Feb 23, 2013
Messages
31
Hi,

I've got a form with two fields, a combo box and plain text field.

I'm trying to setup an event that will run a query when the combo box field is changed. The query should then be filtered on the value of the combo box.

Then the plain text field in the form, should update with a value generated by the query.

How would i best accomplish this?

Thanks
Denis
 
What exactly do you mean by combo box field is changed
? in
run a query when the combo box field is changed

Do you mean when a different value is selected?

Can you tell us in plain English WHAT you are trying to do? Give us an example.
 
Sorry,

Yes when i change the value of the combo box (from the pick list) i want it to run a query.

Table 1:

LeaseID
Initial Pay Date

Form 1:

LeaseID (as a combo box)
Payment Due Date

Query 1:
LeaseID
Payment Due Date (calculated query field from initial pay date in table 1)

When i change the LeaseID in form 1, i want it to run query 1, setting the LeaseID as the criteria, and then for it to put the payment due date calculated value from the query, into the payment due date field in form 1.

Thanks in advance.
 
I think you should use the After update event of the combo
 
I'll expand on jdraw's remarks for you. Include the date field in the RowSource for the combo (don't forget to change the column count in the control or the combo will stop working correctly and set its width to 0 because you don't want to see it). Then in the AfterUpdate event of the combo, you can reference the date field and increment it.

Me.SomeDate = Me.SomeCombo.Column(2) + whatever

The columns collection is a zero-based array so .Column(2) refers to the third field in the RowSource. Adjust the column number as necessary for your situation.
 

Users who are viewing this thread

Back
Top Bottom