Rx_
Nothing In Moderation
- Local time
- Today, 09:24
- Joined
- Oct 22, 2009
- Messages
- 2,803
See Attachment:
A SQL Statement receives criteria from the selections on two listboxes.
In the first two Fields
APD_FieldWorkdates is a PK long Autocounter
The ID_Wells is a FK long Autocounter
The query is based on a single table
Listbox 1 chooses a specific record with a known APD_FieldWorkDates and Know ID_Wells
Listbox 1 will always return 1 and only 1 record.
Listbox 2 only provides an ID_Wells. It will produce 0 to Many records
The problem is the sort order of the return.
The objective is to have the single record from listbox 1 always on Top.
The rest of the 0 to Many can be returned in any order.
The 0 to Many APD_FieldWorkDates OR the ID_Wells could possibly be smaller than the First record.
This could be accomplished in DAO code by running Listbox 1 first and apppending it to a blank recordset, then running the 2nd criteria and appending it.
Is there a way to accomplish this in a SQL Statement?
A SQL Statement receives criteria from the selections on two listboxes.
In the first two Fields
APD_FieldWorkdates is a PK long Autocounter
The ID_Wells is a FK long Autocounter
The query is based on a single table
Listbox 1 chooses a specific record with a known APD_FieldWorkDates and Know ID_Wells
Listbox 1 will always return 1 and only 1 record.
Listbox 2 only provides an ID_Wells. It will produce 0 to Many records
The problem is the sort order of the return.
The objective is to have the single record from listbox 1 always on Top.
The rest of the 0 to Many can be returned in any order.
The 0 to Many APD_FieldWorkDates OR the ID_Wells could possibly be smaller than the First record.
This could be accomplished in DAO code by running Listbox 1 first and apppending it to a blank recordset, then running the 2nd criteria and appending it.
Is there a way to accomplish this in a SQL Statement?