Share via

Access form looses focus

Anonymous
2019-03-23T03:15:17+00:00

Please bare with me.  I am very new a this.  I have created a form providing entries to a table.  I have created an embedded event macro on the lost focus event.  It creates a TempVar that is used with another TempVar from earlier in the form as parameters in a query.  The result of the query is put into a TempVar then put into a form control using Set Property.  I use Close window to close the query.  When done instead of stepping to the next control focus seems to be thrown to the Navigation Pane.  When I click or touch the form focus returns to the next control where it should be.  What have I missed, done wrong or messed up?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. ScottGem 68,830 Reputation points Volunteer Moderator
    2019-03-25T00:18:52+00:00

    Since a query can return multiple columns and records, you can't set a TempVar to a query. What you CAN do is ensure the query returns only one column and one record, then use a DLookup to set the value of the Tempvar

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-03-24T23:53:40+00:00

    Answered my own question.  Many thanks to Scott and Daniel.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-03-24T23:04:13+00:00

    So to get the result of a query; into a tempvar I only need to set the tempvar equal to the query field?

    Was this answer helpful?

    0 comments No comments
  4. ScottGem 68,830 Reputation points Volunteer Moderator
    2019-03-23T20:17:44+00:00

    To run a query there is no need to open it. So in that case, the query window would never gain focus and it would stay in the form. Once the Query object gets focus it ends the code running on the form.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2019-03-23T17:28:22+00:00

    I think we're going to need to see a copy of the database or at the very least the code/macros involved.

    Was this answer helpful?

    0 comments No comments