
Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
This subform A is continous form,and display number of purchased items in
sales order.
This subform Ahas price box text field when cursor is at this textbox and
pressing F5, it display another form C which displays price list and user can
pick price from that form by click Paste price. and Price will appear on
subform A price box.
But problem is it always paste price in very first row of continous form
instead of setting price for 2nd or any other row
> > When button_1 clicked
> >
[quoted text clipped - 23 lines]
>
> AbsoultePosition is "zero" based, so in the above, 3 is the 4th reocrd.
Albert D. Kallal - 14 May 2008 12:43 GMT
> This subform A is continous form,and display number of purchased items in
> sales order.
[quoted text clipped - 5 lines]
> But problem is it always paste price in very first row of continous form
> instead of setting price for 2nd or any other row
I got the above.
Did you see/try the two lines of code I posted? It should work and allow you
to update the 4th record as you requested
give that sample code a try, here is the code again:
Me.MySubFormName.Form.Recordset.AbsolutePosition = 3
me.MySubFormName!price = 123
AbsoultePosition is "zero" based, so in the above, 3 is the 4th reocrd.

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
Albert D. Kallal - 14 May 2008 12:52 GMT
> This subform A is continous form,and display number of purchased items in
> sales order.
[quoted text clipped - 5 lines]
> But problem is it always paste price in very first row of continous form
> instead of setting price for 2nd or any other row
OK, when you launch that form C, and select the price value, your code to
update the sub-form price value should simply be:
forms!MainFormName!SubFormName!Price = me.Price (from form c).
I assume that form "c" is closed right after the person selects the price.
So, either use the close event of form c, or the after udpate event of the
combo box to "set" the value of price.
Your original request to say that you have to update the fourth record only
who was a bit confusing, and I now understand you simply want to update the
current record that the sub form happens to be on it that point in time when
you launch your view form "c".
The above syntax should allow you to do this, of course if you've got
anything that require ease the sub form, then that's going to mess this up.
on the other hand, there should be no need to read query this sub form
anyway.

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
Ayaz Hoda - 14 May 2008 14:51 GMT
Hi Albert
I am using following code which is similar to you
but same result
Forms(p)(c)!Price = Format(Me!Price, "#0.00")
Forms(p)(c)!Price.SetFocus
DoCmd.Close acForm, "PriceHelp"
Regards
Ayaz
> > This subform A is continous form,and display number of purchased items in
> > sales order.
[quoted text clipped - 24 lines]
> on the other hand, there should be no need to read query this sub form
> anyway.
Ayaz Hoda - 19 May 2008 10:43 GMT
In Access 2007 the F5 key executes a data refresh of the form.
Therefore when you press F5 the currentrecord in the subform is reset due to
the data refresh.
To solve this you need to cancel the data refresh as follows:
Wherever you have the code in for F5
If KeyCode = 116 Then 'Do Something ------------
Replace with
Private Sub Price_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then
'Do something
KeyCode = 0
End If
------
I hope this will help others encounter same issue
> Hi Albert
>
[quoted text clipped - 39 lines]
> > on the other hand, there should be no need to read query this sub form
> > anyway.