Me.Requery pops cursor focus to first field in form

G

Guest

I am using ACCESS 2003, an unbound main form, with a bound subform. It is
essentially an order form, the general customer and order info is in the main
unbound form and the order items in the bound subform.

In the bound subform, I am using the continuous forms view and dispalying
the following fields:
* Product No (pulldown from product table)
* size (pulldown from product size table)
* quantity (number field with an after update event procedure, that
populates the unit price, based on size and quantity; uses vba code)
* price (auto populated after quantity entered, can be modified by
user to apply discounts, i have an afer update event procedure which
repaints to get amount to refresh correctly)
* Amount (subtotals the product cost; uses expr
=(nz(txt_Quantity.Value,0))*(nz(txt_UnitPrice.Value,0)))

The problem is that after the I enter the quantity (whether it is the first
order item or the second or third, etc. ) the cursor jumps to the first field
in the first row of the subform, highlighting the value in the field. This is
because I have a Me.Requery command in the code - which is required otherwise
the unit price and amount won't refresh (Me.Repaint won't cut it).

I turned the tabs off so as not to confuse the user who likes to use tabs,
they have to click between fields but it is still really annoying especially
when you are entering the 3rd or 4th order item and the cursor jumps back up
to the first orderitem.

I tried adding
Me.txt_UnitPrice.SetFocus
Me.Repaint

after the Me.Requery but since the focus goes to the first row, the price is
selected in the first row, not the row the user is working in.

What I would really like to do is set the focus in the first field of the
new row at the bottom of the form. I am sure there is an easy way to do this,
but I am at my wits end with this thing and I could really use a break.

Thanks in advance for any suggestions! Happy New Year!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top