Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Delimiters must always be in pairs. If EmpID is text field then:



    Me.chkActive = DLookup("Active", "tblEmpDetails", "EmpID='" & Me.cboSearchName & "'")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #17
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    when I input
    Code:
    CurrentDb.Execute "UPDATE EmployeeDetails SET Active = " & Me.checkbox & " WHERE EmpID=" & Me.EmpID
    what event do I use ie. On Click, After Update?

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try checkbox Change event.

    Again, if EmpID is text field, need the apostrophe delimiters in the WHERE clause.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #19
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    there is no option to Change Event??
    in the following code I am recieving the following error
    Code:
    Private Sub cboSearchName_AfterUpdate()
    Me.chkActive = DLookup("Active", "tblEmpDetails", "EmpID = '" & Me.cboSearchName & "'")
    Click image for larger version. 

Name:	debug.png 
Views:	6 
Size:	15.5 KB 
ID:	14920

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What's wrong with change event? It seems to work just fine.

    However, the DLookup goes in the combobox AfterUpdate event.

    The UPDATE action goes in the checkbox Change event.

    Don't know why the objection to setting value of unbound checkbox. It works for me.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #21
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    In Events I only have the following options
    On Click
    Before Update
    On Got Focus
    On Lost Focus
    On Dbl Click
    On Mouse Down
    "" "" UP
    On Key Down
    "" "" Up
    "" "" Press
    On Enter
    On Exit

    I also tried Me.chkActive.ControlSource = DLookup("Active", "tblEmpDetails", "EmpID = '" & Me.cboSearchName & "'")
    that didnt give me an error but the checkbox just stayed blue and when I checked the controlsource in now says -1

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Sorry, I was mixing thread replies. The checkbox AfterUpdate event does work. I just tested.

    No, do not want to set ControlSource property. That will not allow user to change the checkbox value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #23
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    I found something interesting
    I made a test textbox to see what was being returned by the cboSearchName.Column(5)
    for the ones with active ticked I recieved A 0 and for the ones that arent ticked i recieved -1

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That sounds absolutely backwards.

    If you want to provide db for analysis, follow instructions at bottom of my post. Identify object involved.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Student Check-in / Check-Out Activity Log
    By charliejoe in forum Sample Databases
    Replies: 6
    Last Post: 02-09-2016, 10:02 AM
  2. Replies: 35
    Last Post: 01-08-2014, 01:33 PM
  3. Check For Duplicate Check Before Posting.
    By burrina in forum Queries
    Replies: 1
    Last Post: 01-22-2013, 01:39 PM
  4. Check if record exists, Check Number
    By burrina in forum Forms
    Replies: 9
    Last Post: 01-06-2013, 03:49 PM
  5. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 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