Hi everyone,
First let me describe what i want to do:
I have a subform with my stock list (datasheet view).
I want to add checkboxes next to each item to then either print, or sell the selected stock items
How far have i arrived:
The datasheet source is a query.
SELECT Stock.Lot_Nr, checkSelected([stock].[Stock_ID]) AS stockSelected, Stock.Stock_ID
FROM Stock LEFT JOIN Selected ON Stock.Stock_ID = Selected.stockid;
I successfully created a checkbox that appears on the datasheet through the query.
The value of the checkbox is also correctly reflected (testing dummy values). The way I made this work is by using a table "Selected" where I enter the stockID of the selected items. I have a function "CheckSelected" that is called in the query, which basically checks if the item is selected or not. Based on that the checkbox will be on or off.
Public Function checkSelected(ByVal idofstock As Long) As Boolean
If (Nz(DLookup("stockid", "Selected", "stockid = " & idofstock), 0) = 0) Then
checkSelected = False
Else
checkSelected = True
End If
End Function
My problem:
All seems fine, except that now of course I want to click checkboxes and add or remove selected stockitems from table "Selected"
HOWEVER: the onclick or beforeupdate or afterupdate events of the checkbox are not responding.
I even tried to put a simple msgbox in those event, no other code. Nothing appears....
The dblclick event works, the gotfocus event works, but I can't seem to change the checkbox value using simple clicks...
Pls help?
much appreciated
I have created a db that simulates exactly what i'm trying to do with all the same code and everything. You can use this if you want to better understand.