Results 1 to 3 of 3
  1. #1
    degras is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    72

    Weird problem of focus changing when data is entered

    I have a form for invoices and it has a subform for invoice items. Sometimes when entering data on the subform the focus automatically changes (e.g. the cursor jumps) from the item price to the item description. This makes it impossible to enter any data for the item price. There is no obvious reason why this happens, there are no SetFocus commands for example. However there is a Me.Recalc call when exiting the item price field, this is neccessary for updating the total. I think that this problem only occurs when the invoice form has a filter switched on. Anybody have a solution to this?



    Thanks.

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by degras View Post
    I have a form for invoices and it has a subform for invoice items. Sometimes when entering data on the subform the focus automatically changes (e.g. the cursor jumps) from the item price to the item description. This makes it impossible to enter any data for the item price. There is no obvious reason why this happens, there are no SetFocus commands for example. I think that this problem only occurs when the invoice form has a filter switched on. Anybody have a solution to this?

    Thanks.
    Do you have any codes behind any of these fields?

  3. #3
    degras is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    72
    Quote Originally Posted by Toyman View Post
    Do you have any codes behind any of these fields?
    Yes, sorry but I changed the code and the problem has changed slightly. Now data can be entered on the item price field but the focus changes to the item description when exiting the field. So tabbing to the next field (the total) after the item price does not work. Note the total is disabled as it is a calculated field.

    This is the code I now have:

    Private Sub DoCalc()
    Me.Totals = Me.UnitPrice * Me.Qty
    Me.Recalc
    End Sub

    Private Sub Qty_Exit(Cancel As Integer)
    DoCalc
    End Sub

    Private Sub UnitPrice_Exit(Cancel As Integer)
    DoCalc
    End Sub

    Sometimes focus gets stuck on the item price or the qty field.

    ...OK I solved this now. Instead of the line Me.Recalc I put Me.Dirty = false, and moved the Recalc to the main form:
    Private Sub ItemsSubform2_Enter()
    Me!ItemsSubform2.Form.Recalc
    ...

    Private Sub ItemsSubform2_Exit(Cancel As Integer)
    ItemsSubform2_Enter
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Weird problem after splitting DB
    By crowegreg in forum Programming
    Replies: 1
    Last Post: 09-09-2011, 09:50 AM
  2. Changing focus on a form
    By Shag84 in forum Forms
    Replies: 3
    Last Post: 07-15-2011, 01:51 PM
  3. Data Going Weird on Different Computer
    By Gary MacDonald in forum Access
    Replies: 5
    Last Post: 05-20-2011, 08:53 AM
  4. Weird Form Control Problem
    By MWB in forum Access
    Replies: 3
    Last Post: 11-17-2010, 05:42 PM
  5. Replies: 8
    Last Post: 11-12-2010, 10:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums