Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    QUADRUPLED! Even printed out the "Firstname" field of the record being searched! Isn't this a bitch


    Click image for larger version. 

Name:	006.jpg 
Views:	13 
Size:	42.9 KB 
ID:	44363

  2. #17
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    The form itself is really about as vanilla as one can get. I'm going to pursue the thought that perhaps in some way the form itself has become corrupted. I don't know if that's just "grasping for straws" or what, but it won't harm to at least investigate............. SIGH!

    Click image for larger version. 

Name:	007.jpg 
Views:	14 
Size:	245.2 KB 
ID:	44364

    BTW, the Yes/No check boxes are only maintained in the DB as a single Yes/No field. The user just requested there be two boxes, which of course required a pair of AfterUpdates for each one.

  3. #18
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Ignore this double "delayed by a black hole" post !!!!
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    OK, I think I see the problem, you have the form set as Data Entry= Yes so it will always open on a new record.
    Change that to No and your original code should work. Also for the preferences check box pairs you could easily replace them with option groups (one for each pair) and bind the Option Group (the frame itself, not the two individual checkboxes) to the individual Yes/No fields from the table. No code needed

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thank you Gicu, "Data Entry = No" solved the OP issue.

    Now I get a 2950 error in the OnOpen code. That's a new one on me. Has all the messing around with the OP caused more problems?

    Click image for larger version. 

Name:	008.jpg 
Views:	11 
Size:	90.2 KB 
ID:	44369 Just a command button, "DoCmd.Close"

    Not sure what you're suggesting with the "Option Group". There's only one field in the back-end DB. For display purposes, the AfterUpdate code simply for each check box sets its companion to "NOT", i.e.,
    Code:
    Private Sub chkTxtNo_AfterUpdate()
    chkTxtYes = Not chkTxtNo
    bolChanges = True
    End Sub
    
    Private Sub chkTxtYes_AfterUpdate()
    chkTxtNo = Not chkTxtYes
    bolChanges = True
    End Sub

  6. #21
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In the future:
    Always check the value of the NoMatch property to determine whether the Find operation has succeeded.
    If the search succeeds, NoMatch is False.
    If it fails, NoMatch is True and the current record isn't defined.
    In this case, you must position the current record pointer back to a valid record.
    Recordset.FindFirst method (DAO)


    Code:
    Private Sub Form_Open()
        Dim rs As DAO.Recordset
        
        Set rs = Me.RecordsetClone
        rs.FindFirst "[RegistryID] = " & lngRecID
        If rs.NoMatch Then  'NoMatch = TRUE
            '(lngRecID not found)
            MsgBox "Record not found."
        Else                'NoMatch = FALSE
            '(lngRecID found)
            Me.Bookmark = rs.Bookmark
        End If
        
        Set rs = Nothing
    End Sub
    Good luck with your project....

  7. #22
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I don't see any command button on the form so I assume cmdFinished button is no longer there. This suggests you do not have "require variable declaration" checked in the VBA Project Options (it puts Option Explicit on top of all your modules). If it is not there just add it and try to compile. If the button does exist try instead to set its Tab Stop to 0 if you want it to be the first that gets focus.

    Regarding the code you show, you do not need any of that if you use option groups instead. Remove the two checkboxes (chkTextYes,chkTextNo), add an option group with two check boxes (one for each field), set the labels and values (Yes=-1,No = 0) and bind the option group (frame) to the field:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	13.8 KB 
ID:	44374Click image for larger version. 

Name:	Capture1.PNG 
Views:	9 
Size:	26.2 KB 
ID:	44375Click image for larger version. 

Name:	Capture2.PNG 
Views:	9 
Size:	17.7 KB 
ID:	44376

    Remove the code you have and try it. The option group will load and save whatever value the field has.
    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #23
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Thanks Steve,
    I will add the NoMatch to the code.
    Bill

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-10-2020, 11:18 AM
  2. Runime Error '3021': - No current record
    By Mohanss82 in forum Programming
    Replies: 2
    Last Post: 07-04-2016, 02:34 AM
  3. sql error . runtime 3021 - no current record
    By princess12 in forum Access
    Replies: 3
    Last Post: 04-10-2015, 09:26 AM
  4. Error 3021 no current record
    By bbrazeau in forum Programming
    Replies: 10
    Last Post: 12-13-2012, 04:22 PM
  5. "No Current Record" error...not sure why it is there
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 01-25-2011, 10:14 AM

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