They are in a table, Warnings, PK WarningID. The other field just contains
the 19 warnings
Here is an SQL statement that will return only Warnings the Driver has not
received:
SELECT Warnings.WarningsID, DriversWarnings.WarningsID
FROM Warnings LEFT JOIN DriversWarnings ON Warnings.WarningsID =
DriversWarnings.WarningsID
GROUP BY Warnings.WarningsID, DriversWarnings.WarningsID
HAVING (((DriversWarnings.WarningsID) Is Null));
It should go in the After Update event of whatever control you use to select
a warning for the driver. You will also need to Requery the combo box each
time you assign a warning to a driver.
Now, as to how it will affect the other rows in your continuous for, I am
not sure, and don't have a way to test it.
I think the suggest solution to put a text box over the combo is ugly. If
the above solution does not work, then I would suggest you use a DLookup to
see if the Driver/Warning combination already exists, present an message box
with the error, and cancel the update on the control. This is certainly not
as elegant as what you want to do, but it may be necessary.
Let me know how it works out.
> They are in a table, Warnings, PK WarningID. The other field just contains
> the 19 warnings
[quoted text clipped - 34 lines]
> > > TIA
> > > Rich
Rich1234 - 30 Sep 2005 14:37 GMT
Thanks for your post Klatuu
Where should I put this SQL? You mention it should go in the After Update
event of the control I am using to select a warning. I pasted it into the
after update event procedure and the SQL was coloured red (this must be the
wrong place to put it... this is just for VB, right?)
I am using the combo to select warnings (in the detail section of a
continuous subform) and so I want only warnings that aren't already assigned
to appear in the combo (so does this query need to go in the rowsource for
the combo?) Presumably I would then put the requery in the after update
event of the combo?
The message box idea is fine if it works. But I don't see why it would be
needed. If the combo on each record in the subform only included warnings
that weren't already selected, it would be impossible to select a duplicate.
That is the thinking behind all of this. If there is another way of doing
this, fine.
Do I need to create a query outside of the combo box, give it a name and
refer to this query name as the row source for the combo, or can I put it
directly into the combo itself? (Does this make any difference? What's
confusing me is the fact that the combo has to "requery" after each
selection.)
Throughout all of this I have been unclear on where to put the SQL. Surely
excluding the selected warnings from rowsource for the combo is the key to
sorting this....? What am I doing wrong? The textbox idea was to put a
textbox carefully positioned directly over the combo so that it would still
display the previously selected warning (using DLookup) for that driver
(which would now not show up as it would be excluded from the row source.)
Have I explained all this OK?
Looking forward to your thoughts on this one
Rich
> Here is an SQL statement that will return only Warnings the Driver has not
> received:
[quoted text clipped - 57 lines]
> > > > TIA
> > > > Rich
Klatuu - 03 Oct 2005 13:23 GMT
The SQL statement should be the row source for the combo box. Do your
requery in the After Update event.
> Thanks for your post Klatuu
>
[quoted text clipped - 92 lines]
> > > > > TIA
> > > > > Rich
Rich1234 - 03 Oct 2005 17:03 GMT
I put this SQL in as the rowsource, togther with the requery in the After
Update event but it isn't working. When you click on the down arrow at the
end of the combo to view the list, there are no items showing in the list at
all. The "dropdown" doesn't appear.
Any more ideas? How is this possible?
Thanks Klatuu for your advice so far
rich
> The SQL statement should be the row source for the combo box. Do your
> requery in the After Update event.
[quoted text clipped - 95 lines]
> > > > > > TIA
> > > > > > Rich
Klatuu - 03 Oct 2005 17:21 GMT
Since I don't have everything you have in front of me, I can't be sure.
There may be an error in the way the SQL statement is structured. It (sorta)
works, because it does not return an error, but there is something in the way
it is looking at the table.
SELECT Warnings.WarningsID, DriversWarnings.WarningsID
FROM Warnings LEFT JOIN DriversWarnings ON Warnings.WarningsID =
DriversWarnings.WarningsID
GROUP BY Warnings.WarningsID, DriversWarnings.WarningsID
HAVING (((DriversWarnings.WarningsID) Is Null));
> I put this SQL in as the rowsource, togther with the requery in the After
> Update event but it isn't working. When you click on the down arrow at the
[quoted text clipped - 103 lines]
> > > > > > > TIA
> > > > > > > Rich