Results 1 to 5 of 5

Thread: [Resolved] Beginner's question

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    35

    [Resolved] Beginner's question

    I have a form in datasheet view and am trying to write some VB to go with it. Two questions:

    1) Is there a property for which record the cursor is sitting in that I can refer to in the code?

    2) Can I write code such that when I click on a record it highlights the whole line (as if I had clicked on the grey square to the left of it)

    Thanks v much for your help
    Last edited by jrpfinch; Aug 24th, 2004 at 12:46 PM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I take it that you are using Access. For the first question, I think
    the event is "Private Sub Form_Current()". Not too sure because
    I know it works for a form in Form view. So for Datasheet view ?
    For the second question I dont think so.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    35
    Sorry I think I must have phrased the question wrongly

    1) How can I identify which record the cursor is in on a form which has a datasheet in it? (I'm guessing it's something like frmMain.ActiveRecord or similar)

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    VB Code:
    1. Me.CurrentRecord
    Will give you the record that the user has the cursor in. If you
    click on a record you will see the data control change its position.
    For example if you have 50 records total and you click on the 25th
    record then the data control change to say "25 of 50 Records".
    So thats why I thought that the Current event would give you
    the info. These properties also should help you get what you
    want.

    Me.CurrentRecord
    Me.CurrentSectionLeft
    Me.CurrentSectionTop
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    35
    Thanks that's perfect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width