Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
How Do I Stop a First Record From Being Selected
Bill Carver 
      
13 months ago
I have a table with a simple script

the script is here
Private Sub Name_DblClick(Cancel As Integer)
On Error GoTo myerr
selall

DoCmd.OpenForm "candidates", acNormal, , "driverid=" & DriverID


myerr: Resume Next
End Sub

I use conditional formatting to highlight the selected record. That works perfectly.  However access keeps selecting the first record in the subform.  how do i kill that?
Kevin Robertson  @Reply  
          
13 months ago
You could go to a new record (Allow Additions must be set to Yes)

DoCmd.OpenForm "candidates", acNormal, , "driverid=" & DriverID
DoCmd.GoToRecord acDataForm, "Candidates", acNewRec
Bill Carver OP  @Reply  
      
13 months ago

Bill Carver OP  @Reply  
      
13 months ago
I appreciate you Kevin.  but that broke it.  what I really need is the record selection to be cancelled as if I escaped out of the field
I want to keep the yellow highight but lose the black select
Kevin Robertson  @Reply  
          
13 months ago
How about this?

Forms!Candidates.ActiveControl.SelStart = 0
Bill Carver OP  @Reply  
      
13 months ago
That didn't change the behavior.
Bill Carver OP  @Reply  
      
13 months ago
I have exorcized the demons!
I just happened to run across Richard''s video on selecting a specific record in a subform from the parent form.  

I want to have the conditional formatting do it's thing to highlight the record and not select it..  so here's what I did

Ner the subform so the screen doesn't move when I double click the record I place a transparent (not hidden) field.

Then on the double click event... here we go.

Private Sub Name_DblClick(Cancel As Integer)
On Error GoTo myerr
selall

DoCmd.OpenForm "candidates", acNormal, , "driverid=" & DriverID

DoCmd.GoToControl "candidates"
DoCmd.GoToControl "aplace2land"

myerr: Resume Next
End Sub

Mark Fannin  @Reply  
      
13 months ago
Very interesting.  Possibly a stupid question, but what is "selall" ?
Kevin Robertson  @Reply  
          
13 months ago
Why do you have TWO DoCmd.GoToControl commands?
Bill Carver OP  @Reply  
      
13 months ago
selall is a typo and was later removed
Bill Carver OP  @Reply  
      
13 months ago
the form i'm on is a subform.  the second is a transparent field that will capture the selection out of the subform.  I also added an after update script to set aplace2land as "" or null
Kevin Robertson  @Reply  
          
13 months ago
OK. That's one reason why some sort of identifying naming convention is helpful.

For example:
    - FormNameF
    - FormNameSubF
    - btnButtonName
    - txtTextboxName
    - lblLabelName

I also feel that proper capitalisation is as important.
Bill Carver OP  @Reply  
      
13 months ago
good advice..I just had no discipline when i made it

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 5:10:50 PM. PLT: 1s