Re: after update populate field from a query
- From: "Duane Hookom" <duanehookom@xxxxxxxxxxxxxxxxx>
- Date: Tue, 10 Jan 2006 09:18:44 -0600
If you update the combo box and the cost value in the text box "txtCost" is
0 or null then the value from the combo box column will be updated.
--
Duane Hookom
MS Access MVP
--
"Bart" <franklynot@xxxxxxxxxxx> wrote in message
news:7BB9F785-BD83-4DB8-9AE5-A3E3DCFF7117@xxxxxxxxxxxxxxxx
> sorry about slow response, had to leave town.
> Ok, If You say if I update the combo box in my form the values will
> change.
> is that only if i go back to the earlier dates and update . and this code
> you wrote will prevent that from happening correct.
>
> THank you for your patience.
> --
> Bart
>
>
> "Duane Hookom" wrote:
>
>> If you use the after update event to place the Current/Last cost in
>> another
>> field, then when the costs change, the store value in "another" field
>> will
>> not change. However, if you update the combo box, the code would update
>> the
>> "another" field again with the current, last cost.
>>
>> If you don't want this to happen, you might use code like:
>>
>> If Nz(Me.txtCost,0) <> 0 Then
>> Me.txtCost = Me.cboIngredient1.Column(x)
>> End If
>>
>> --
>> Duane Hookom
>> MS Access MVP
>> --
>>
>> "Bart" <franklynot@xxxxxxxxxxx> wrote in message
>> news:44B40E12-6367-41BC-BFD2-0F59F8453FE3@xxxxxxxxxxxxxxxx
>> > Yes it is and I did that same exact thing and it works fine, thanks for
>> > your
>> > reply. But I have just come across a flaw in the logic. On my form I
>> > choose
>> > an ingredient for ingredient 1 and it populates ingcost1 with the
>> > lastcost
>> > for that ingredient lets say in january it is $1.00. This cost goes in
>> > the
>> > fiels on my production table for that day and is used in calculating
>> > cost
>> > per
>> > day , month , and per unit. Now in Feb there is a price increase so
>> > all
>> > records for feb will have lets say $2.00. Will all the records prior
>> > to
>> > the
>> > increase stay at 1.00 or will they now get changed to 2.00.
>> > --
>> > Bart
>> >
>> >
>> > "Duane Hookom" wrote:
>> >
>> >> Isn't your combo box on a form? I would include a column in the combo
>> >> box
>> >> that is the "LAST" cost. You can then add code in the After Update
>> >> event
>> >> of
>> >> the combo box to update a text box bound to the Cost field.
>> >>
>> >> Me.txtCost = Me.cboIngredient1.Column(x)
>> >>
>> >> x is the column number from the combo box where 0 would be the first
>> >> column.
>> >>
>> >> --
>> >> Duane Hookom
>> >> MS Access MVP
>> >> --
>> >>
>> >> "Bart" <franklynot@xxxxxxxxxxx> wrote in message
>> >> news:0DA10E9E-0438-4827-8F77-EC3DC4805535@xxxxxxxxxxxxxxxx
>> >> >I have 2 fields ingredient1 wich is a combo box to choose an
>> >> >ingredient
>> >> > from a table of ingredients called material. I also have ingredient
>> >> > cost
>> >> > table where we update the cost of the ingredients. I have a query
>> >> > of
>> >> > the
>> >> > inredientcost tabel that list each ingredient with the LAST cost
>> >> > from
>> >> > the
>> >> > ingredient cost table. in the after update event on the combo box I
>> >> > would
>> >> > like to populate the ingcost1 field with the corresponding value
>> >> > from
>> >> > this
>> >> > query. I tried something like this.
>> >> >
>> >> > Me!IngCost1 = Query![material] !Cost
>> >> >
>> >> > Thanks
>> >> > Bart
>> >>
>> >>
>> >>
>>
>>
>>
.
- Follow-Ups:
- Re: after update populate field from a query
- From: Bart
- Re: after update populate field from a query
- References:
- Re: after update populate field from a query
- From: Duane Hookom
- Re: after update populate field from a query
- From: Duane Hookom
- Re: after update populate field from a query
- From: Bart
- Re: after update populate field from a query
- Prev by Date: Re: How do I open a report using a command button on a form?
- Next by Date: Re: No current record - error message.
- Previous by thread: Re: after update populate field from a query
- Next by thread: Re: after update populate field from a query
- Index(es):