Results 1 to 7 of 7
  1. #1
    msange is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    4

    Loosing Cursor on Form after Set Me.Recordset = Rs

    I am facing a unique problem with Recordset, struggling to resolve since a couple of days and requesting assistance, please.
    Dim Rs as DAO.Recordset
    Dim db as DAO.Database
    Dim Path_ as String
    Path= “C:\Test.accdb”

    Set db = OpenDatabase(Path_, False, False)
    Sql = “Select * From tbl_Users”
    Set Rs = db.OpenRecordset(Sql)
    Set Me.Recordset = Rs
    txtTextBox.SetFocus

    Record displays but the cursor is lost, except CTRL + TAB no other key on keyboard works unless anywhere on the form mouse is clicked. This is strange this only happens when Set Me.Recordset = Rs is applied. Tried on multiple PC with the same result.

    Alternative below work
    Sql = “Select * From [“ & Path_ & “].tbl_Users”


    Me.Recordsource = Sql
    Me.Requery
    txtTextBox.SetFocus

    This works perfect and not facing any issues.

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Code:
    This works perfect and not facing any issues.
    So, what is the problem?

  3. #3
    msange is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    4
    Set db = OpenDatabase(Path_, False, False)
    Sql = “Select * From tbl_Users”
    Set Rs = db.OpenRecordset(Sql)
    Set Me.Recordset = Rs
    txtTextBox.SetFocus
    Record displays but the cursor is lost, except CTRL + TAB no other key on keyboard works unless anywhere on the form mouse is clicked.

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Fix thse problams and try again...
    Code:
    Dim Sql as string              'missing
    Dim Rs as DAO.Recordset
    Dim db as DAO.Database
    Dim Path_ as String
    Path= “C:\Test.accdb”        'should be Path_
    
    Set db = OpenDatabase(Path_, False, False)
    Sql = “Select * From tbl_Users”
    Set Rs = db.OpenRecordset(Sql)
    Set Me.Recordset = Rs
    txtTextBox.SetFocus

  5. #5
    msange is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    4
    Same Record displays but the cursor is lost, except CTRL + TAB no other key on keyboard works unless anywhere on the form mouse is clicked.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    You're not telling us something. Your original code COULD NOT have run without syntax errors. What event is the code behind and what is the complete procedure code? Do you have 'Option Explicit' at the top of the module?
    Are you using ODBC connections?
    Furthermore, if the alternate code works OK, why not use that, and abandon code that doesn't?

  7. #7
    msange is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    4
    I am trying the first option because it is faster accessing external MS Access file over a network drive. For time being I found a HACK

    SendKeys "%"
    SendKeys "{ESC}"

    cursor return back to form and rest works normal. Strange behaviour.

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

Similar Threads

  1. Open pop up form at cursor.
    By ser01 in forum Forms
    Replies: 5
    Last Post: 08-06-2013, 11:09 AM
  2. cursor in a blank form
    By kris335 in forum Forms
    Replies: 3
    Last Post: 09-26-2012, 02:26 PM
  3. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  4. Form loosing link to table
    By kcm4491 in forum Forms
    Replies: 9
    Last Post: 03-23-2011, 07:27 AM
  5. Loosing list box slection after refresh
    By oakoen in forum Forms
    Replies: 6
    Last Post: 11-23-2010, 11:21 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