Delimiters must always be in pairs. If EmpID is text field then:
Me.chkActive = DLookup("Active", "tblEmpDetails", "EmpID='" & Me.cboSearchName & "'")
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.
when I input
what event do I use ie. On Click, After Update?Code:CurrentDb.Execute "UPDATE EmployeeDetails SET Active = " & Me.checkbox & " WHERE EmpID=" & Me.EmpID
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.
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.
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
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.
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
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.