Results 1 to 5 of 5
  1. #1
    ussmex is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    5

    Losing Cursor on Form after Set Me.Recordset = Rs

    Greetings,

    I'm experiencing the same problem as in the post titled "Loosing Cursor on Form after Set Me.Recordset = Rs".

    In my VBA code I set the recordset, then setfocus on a textbox. When I "
    Debug.Print Screen.ActiveControl.Name" it names the text box, but the cursor doesn't show in that textbox, and typing on the keyboard has no effect anywhere on the form window. In order for to enter text via the keyboard I must mouse-click the textbox.



    In the aforementioned post the poster mentions his workaround:
    After setting focus on the textbox, he uses SendKeys:
    SendKeys "%"
    SendKeys "{ESC}"
    This works. After the SendKeys runs, the cursor is showing in the textbox, and entry via keyboard is available.

    Does know of a status in which SetFocus has functioned properly, but the cursor is unavailable? Is there a Windows property I can reference to force the cursor into the textbox?

    Thank you!

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Would help if you show your actual code or better still upload a copy of your database - remove all tables/forms/etc not relevant to you question, then compact and zip

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Have never seen this. If we try to replicate it, it would help to know where your code is - standard module or form module. It might matter.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    ussmex is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2021
    Posts
    5
    The code to retrieve the ADODB recordset (EXEC stored procedure) is in a standard module. That code is triggered in a Private Function on a form module, and triggers by a Click event in a listbox.

    Previously, when I was using a linked table as the RecordSource for the form, the cursor was available in the textbox after SetFocus. It is since I have begun trying this new way of populating data using recordsets that this issue has been occurring.
    Code:
    Private Function SelectAllbyOrgID()
        'triggered on lstSearchResults_Click
        strSQL = "EXEC Org.sp_tblOrgSelectAll " & Me.lstSearchResults
        OpenMyRecordset rs, strSQL
        Set Me.Recordset = rs
        Debug.Print Screen.ActiveControl.Name
        Me.txtOrgNameSearch.SetFocus
    End Function

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    so it is an ado recordset, not dao. That probably explains it - access forms are designed to work with dao - they will work with ado but some features do not work. Certainly the filter and sort features will generate an error with ado, quite possible your problem is another 'feature' that does not work.

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

Similar Threads

  1. Module level Recordset variable losing it's value
    By Salty Mariner in forum Programming
    Replies: 15
    Last Post: 12-25-2023, 10:09 AM
  2. Losing data when I close a form
    By Pennguin in forum Access
    Replies: 25
    Last Post: 12-28-2020, 01:00 PM
  3. "Losing" cursor after running import macro
    By klnlsu in forum Programming
    Replies: 4
    Last Post: 06-21-2017, 01:59 PM
  4. Replies: 6
    Last Post: 05-09-2017, 10:43 AM
  5. Losing Records Saved From Form
    By ProgZ in forum Forms
    Replies: 2
    Last Post: 04-17-2011, 11:32 PM

Tags for this Thread

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