I am sorry Nic but I am still struggling to get my head round it. I know I am now into code way above my knowledge level but just have to get this thing done so bear with me please :)....
I understand about adding a sequence column as an 'ID' so to speak.
A couple of questions though
1. Are the queries essential to run the code? Because rather than update to 9-5 I need the user to have complete flexibility by just selecting and deselecting from the multiselect listbox.
2. I tried this code and played with it but kept getting syntax errors....
What does the 'SET YesNo=NOT YesNo' do? I also tried a simple 'SET YesNo = Yes Where...' but couldn't get that to work either.
- Private Sub Command40_Click()
-
-
Dim varItm
-
-
For Each varItm In Me.List38.ItemsSelected
-
CurrentDb.Execute ("UPDATE Table1 SET YesNo = NOT YesNo WHERE Sequence= Me.List38.Column(0, varItm)")
-
-
Next
-
Me.List38.Requery
-
-
End Sub
Also... i've been trying with code for the on current of the form to get those that are 'YES' in the YesNo field to automatically be selected and cannot do that either.
Sorry if you are losing patience :) , i am trying v.hard this end.
OllyJ
1) No queries aren't necessary, but I would use them to initialize the hours so the user doesn't have to select them for the obvious timespan.
An alternative would be to use only the SET YesNo = False to make sure no old setting remains.
2) 'SET YesNo=NOT YesNo' will switch the value.
When True it becomes False and vise versa.
For testing the needed query use the query text in a new query. (Open a new query, select NO table and press the appearing SQL-button top left)
Just copy/paste:
UPDATE Table1 SET YesNo = NOT YesNo WHERE Sequence = 1;
and press the exclamation button [ ! ] to execute the query.
When something is wrong you'll get a warning.
Keep me posted.
Nic;o)
(PS patience is my middle name :-)