DLookup, DSum and DCount in Access
Domain functions fetch a single value from a table or query: the category name for an ID, the quantity sold of a product, the number of orders of a customer. In forms and reports they are indispensable.
In short: DLookup("Field", "Table", "Criteria") returns a value, DSum the sum, DCount the count, plus DAvg, DMin and DMax. The criteria is text; values of the current row are appended with &.
Before you start: Subqueries.
Try it now
Task Show ProductName, UnitPrice and the category name without a JOIN: fetch the category from the Categories table with DLookup.
Products 18 rows, 6 columns
| ProductID | ProductName | CategoryID | UnitPrice | UnitsInStock | Discontinued |
|---|---|---|---|---|---|
| 1 | Blue ballpoint pen | 1 | 1.20 | 121 | ☐ |
| 2 | Highlighter 4-pack | 1 | 3.90 | 76 | ☐ |
| 3 | Hole punch | 1 | 8.50 | 237 | ☐ |
| 4 | Stapler | 1 | 12.90 | 61 | ☐ |
| 5 | Lever arch file | 1 | 2.80 | 76 | ☑ |
| 6 | USB drive 64 GB | 2 | 9.90 | 193 | ☐ |
| 7 | Wireless mouse | 2 | 19.90 | 157 | ☐ |
| 8 | Keyboard | 2 | 34.90 | 216 | ☐ |
| 9 | 27-inch monitor | 2 | 229.00 | 129 | ☐ |
| 10 | Headset | 2 | 49.00 | 47 | ☐ |
| 11 | Office chair | 3 | 189.00 | 135 | ☐ |
| 12 | Desk | 3 | 349.00 | 46 | ☐ |
| 13 | Mobile pedestal | 3 | 129.00 | 105 | ☐ |
| 14 | Copy paper A4 | 4 | 4.50 | 35 | ☐ |
| 15 | Notepad | 4 | 1.90 | 122 | ☐ |
| 16 | Envelopes 100-pack | 4 | 6.90 | 93 | ☐ |
| 17 | Labels | 4 | 7.50 | 75 | ☐ |
| 18 | Laminating pouches | 4 | 11.90 | 211 | ☐ |
Categories 4 rows, 2 columns
| CategoryID | Category |
|---|---|
| 1 | Office |
| 2 | Tech |
| 3 | Furniture |
| 4 | Paper |
The functions
| Function | returns |
|---|---|
| DLookup | the value of a field from the first matching record |
| DSum | the sum over all matching records |
| DCount | the number of matching records |
| DAvg, DMin, DMax | average, smallest, largest value |
The third argument is a criteria like the part after WHERE, but as text. For numbers: "CategoryID = " & [CategoryID]. Text values need quotes inside the text: "Country = '" & [Country] & "'". Without criteria the function works on the whole table.
Summing and empty results
If DSum finds no matching record, the result is Null. Nz turns it into 0.
Task For each product show ProductName and the total quantity sold (sum of Quantity in OrderDetails). Products never sold should show 0, not empty.
Products 18 rows, 6 columns
| ProductID | ProductName | CategoryID | UnitPrice | UnitsInStock | Discontinued |
|---|---|---|---|---|---|
| 1 | Blue ballpoint pen | 1 | 1.20 | 121 | ☐ |
| 2 | Highlighter 4-pack | 1 | 3.90 | 76 | ☐ |
| 3 | Hole punch | 1 | 8.50 | 237 | ☐ |
| 4 | Stapler | 1 | 12.90 | 61 | ☐ |
| 5 | Lever arch file | 1 | 2.80 | 76 | ☑ |
| 6 | USB drive 64 GB | 2 | 9.90 | 193 | ☐ |
| 7 | Wireless mouse | 2 | 19.90 | 157 | ☐ |
| 8 | Keyboard | 2 | 34.90 | 216 | ☐ |
| 9 | 27-inch monitor | 2 | 229.00 | 129 | ☐ |
| 10 | Headset | 2 | 49.00 | 47 | ☐ |
| 11 | Office chair | 3 | 189.00 | 135 | ☐ |
| 12 | Desk | 3 | 349.00 | 46 | ☐ |
| 13 | Mobile pedestal | 3 | 129.00 | 105 | ☐ |
| 14 | Copy paper A4 | 4 | 4.50 | 35 | ☐ |
| 15 | Notepad | 4 | 1.90 | 122 | ☐ |
| 16 | Envelopes 100-pack | 4 | 6.90 | 93 | ☐ |
| 17 | Labels | 4 | 7.50 | 75 | ☐ |
| 18 | Laminating pouches | 4 | 11.90 | 211 | ☐ |
OrderDetails 321 rows, 5 columns
| DetailID | OrderID | ProductID | Quantity | SalePrice |
|---|---|---|---|---|
| 1 | 1 | 1 | 2 | 1.20 |
| 2 | 2 | 17 | 5 | 7.50 |
| 3 | 2 | 12 | 2 | 349.00 |
| 4 | 2 | 8 | 3 | 34.90 |
| 5 | 3 | 3 | 2 | 8.50 |
| 6 | 4 | 6 | 8 | 9.90 |
| 7 | 4 | 3 | 4 | 8.50 |
| 8 | 4 | 7 | 7 | 19.90 |
| 9 | 4 | 10 | 1 | 49.00 |
| 10 | 5 | 1 | 8 | 1.20 |
| 11 | 5 | 4 | 2 | 12.90 |
| 12 | 5 | 14 | 4 | 4.50 |
| 13 | 5 | 12 | 1 | 349.00 |
| 14 | 6 | 14 | 2 | 4.50 |
| 15 | 6 | 13 | 1 | 129.00 |
| 16 | 7 | 7 | 2 | 19.90 |
| 17 | 7 | 8 | 7 | 34.90 |
| 18 | 8 | 5 | 7 | 2.80 |
| 19 | 9 | 5 | 8 | 2.80 |
| 20 | 9 | 3 | 2 | 8.50 |
| 21 | 10 | 8 | 1 | 34.90 |
| 22 | 10 | 2 | 3 | 3.90 |
| 23 | 10 | 1 | 9 | 1.20 |
| 24 | 11 | 15 | 1 | 1.90 |
| 25 | 11 | 2 | 6 | 3.90 |
| 26 | 11 | 13 | 2 | 129.00 |
| 27 | 11 | 10 | 1 | 49.00 |
| 28 | 12 | 11 | 1 | 189.00 |
| 29 | 13 | 13 | 1 | 129.00 |
| 30 | 13 | 16 | 1 | 6.90 |
| 31 | 14 | 13 | 2 | 129.00 |
| 32 | 14 | 5 | 4 | 2.80 |
| 33 | 14 | 4 | 3 | 12.90 |
| 34 | 15 | 6 | 10 | 9.90 |
| 35 | 16 | 4 | 7 | 12.90 |
| 36 | 16 | 14 | 4 | 4.50 |
| 37 | 16 | 3 | 10 | 8.50 |
| 38 | 16 | 9 | 1 | 229.00 |
| 39 | 17 | 7 | 6 | 19.90 |
| 40 | 18 | 15 | 4 | 1.90 |
| 41 | 18 | 7 | 1 | 19.90 |
| 42 | 19 | 9 | 2 | 229.00 |
| 43 | 19 | 13 | 1 | 129.00 |
| 44 | 20 | 4 | 6 | 12.90 |
| 45 | 20 | 5 | 8 | 2.80 |
| 46 | 20 | 12 | 2 | 349.00 |
| 47 | 20 | 17 | 10 | 7.50 |
| 48 | 21 | 8 | 8 | 34.90 |
| 49 | 21 | 5 | 6 | 2.80 |
| 50 | 21 | 7 | 4 | 19.90 |
| 51 | 21 | 15 | 7 | 1.90 |
| 52 | 22 | 3 | 8 | 8.50 |
| 53 | 23 | 9 | 2 | 229.00 |
| 54 | 23 | 2 | 1 | 3.90 |
| 55 | 24 | 9 | 1 | 229.00 |
| 56 | 24 | 6 | 6 | 9.90 |
| 57 | 24 | 2 | 3 | 3.90 |
| 58 | 24 | 4 | 6 | 12.90 |
| 59 | 25 | 7 | 6 | 19.90 |
| 60 | 25 | 14 | 7 | 4.50 |
| 61 | 25 | 15 | 10 | 1.90 |
| 62 | 26 | 5 | 5 | 2.80 |
| 63 | 26 | 17 | 10 | 7.50 |
| 64 | 26 | 9 | 2 | 229.00 |
| 65 | 27 | 14 | 7 | 4.50 |
| 66 | 27 | 4 | 9 | 12.90 |
| 67 | 28 | 6 | 8 | 9.90 |
| 68 | 28 | 7 | 9 | 19.90 |
| 69 | 29 | 14 | 4 | 4.50 |
| 70 | 29 | 7 | 6 | 19.90 |
| 71 | 30 | 5 | 5 | 2.80 |
| 72 | 31 | 10 | 1 | 49.00 |
| 73 | 31 | 17 | 4 | 7.50 |
| 74 | 31 | 9 | 2 | 229.00 |
| 75 | 32 | 14 | 8 | 4.50 |
| 76 | 32 | 11 | 1 | 189.00 |
| 77 | 32 | 9 | 2 | 229.00 |
| 78 | 33 | 17 | 3 | 7.50 |
| 79 | 33 | 12 | 1 | 349.00 |
| 80 | 34 | 1 | 1 | 1.20 |
| 81 | 35 | 15 | 3 | 1.90 |
| 82 | 35 | 8 | 9 | 34.90 |
| 83 | 36 | 2 | 3 | 3.90 |
| 84 | 36 | 15 | 6 | 1.90 |
| 85 | 36 | 8 | 1 | 34.90 |
| 86 | 36 | 7 | 5 | 19.90 |
| 87 | 37 | 2 | 5 | 3.90 |
| 88 | 37 | 9 | 1 | 229.00 |
| 89 | 38 | 17 | 2 | 7.50 |
| 90 | 38 | 13 | 1 | 129.00 |
| 91 | 38 | 6 | 1 | 9.90 |
| 92 | 39 | 1 | 3 | 1.20 |
| 93 | 39 | 10 | 1 | 49.00 |
| 94 | 40 | 14 | 5 | 4.50 |
| 95 | 41 | 10 | 1 | 49.00 |
| 96 | 41 | 15 | 7 | 1.90 |
| 97 | 41 | 11 | 2 | 189.00 |
| 98 | 41 | 17 | 2 | 7.50 |
| 99 | 42 | 2 | 1 | 3.90 |
| 100 | 43 | 3 | 10 | 8.50 |
| 101 | 43 | 17 | 10 | 7.50 |
| 102 | 43 | 14 | 8 | 4.50 |
| 103 | 44 | 10 | 2 | 49.00 |
| 104 | 44 | 8 | 5 | 34.90 |
| 105 | 45 | 16 | 8 | 6.90 |
| 106 | 45 | 3 | 2 | 8.50 |
| 107 | 45 | 5 | 10 | 2.80 |
| 108 | 46 | 5 | 1 | 2.80 |
| 109 | 46 | 7 | 5 | 19.90 |
| 110 | 46 | 17 | 9 | 7.50 |
| 111 | 47 | 5 | 7 | 2.80 |
| 112 | 47 | 12 | 1 | 349.00 |
| 113 | 47 | 10 | 2 | 49.00 |
| 114 | 47 | 3 | 10 | 8.50 |
| 115 | 48 | 13 | 2 | 129.00 |
| 116 | 48 | 8 | 1 | 34.90 |
| 117 | 48 | 12 | 1 | 349.00 |
| 118 | 48 | 4 | 10 | 12.90 |
| 119 | 49 | 8 | 4 | 34.90 |
| 120 | 49 | 15 | 4 | 1.90 |
| 121 | 49 | 2 | 9 | 3.90 |
| 122 | 49 | 1 | 4 | 1.20 |
| 123 | 50 | 14 | 4 | 4.50 |
| 124 | 50 | 4 | 1 | 12.90 |
| 125 | 50 | 13 | 1 | 129.00 |
| 126 | 51 | 6 | 1 | 9.90 |
| 127 | 51 | 2 | 4 | 3.90 |
| 128 | 51 | 12 | 1 | 349.00 |
| 129 | 51 | 7 | 7 | 19.90 |
| 130 | 52 | 17 | 2 | 7.50 |
| 131 | 52 | 8 | 1 | 34.90 |
| 132 | 52 | 3 | 5 | 8.50 |
| 133 | 52 | 2 | 10 | 3.90 |
| 134 | 53 | 13 | 2 | 129.00 |
| 135 | 53 | 3 | 4 | 8.50 |
| 136 | 53 | 5 | 8 | 2.80 |
| 137 | 54 | 11 | 1 | 189.00 |
| 138 | 54 | 17 | 9 | 7.50 |
| 139 | 54 | 2 | 9 | 3.90 |
| 140 | 54 | 10 | 2 | 49.00 |
| 141 | 55 | 8 | 9 | 34.90 |
| 142 | 56 | 6 | 7 | 9.90 |
| 143 | 56 | 11 | 2 | 189.00 |
| 144 | 57 | 16 | 1 | 6.90 |
| 145 | 57 | 4 | 4 | 12.90 |
| 146 | 57 | 11 | 2 | 189.00 |
| 147 | 57 | 13 | 1 | 129.00 |
| 148 | 58 | 16 | 5 | 6.90 |
| 149 | 59 | 15 | 7 | 1.90 |
| 150 | 59 | 11 | 1 | 189.00 |
| 151 | 59 | 4 | 6 | 12.90 |
| 152 | 60 | 8 | 8 | 34.90 |
| 153 | 60 | 15 | 2 | 1.90 |
| 154 | 61 | 17 | 2 | 7.50 |
| 155 | 61 | 2 | 9 | 3.90 |
| 156 | 61 | 5 | 8 | 2.80 |
| 157 | 62 | 4 | 3 | 12.90 |
| 158 | 62 | 17 | 6 | 7.50 |
| 159 | 63 | 11 | 2 | 189.00 |
| 160 | 63 | 15 | 2 | 1.90 |
| 161 | 64 | 7 | 2 | 19.90 |
| 162 | 65 | 4 | 5 | 12.90 |
| 163 | 65 | 5 | 7 | 2.80 |
| 164 | 65 | 17 | 7 | 7.50 |
| 165 | 66 | 9 | 2 | 229.00 |
| 166 | 66 | 12 | 1 | 349.00 |
| 167 | 66 | 15 | 10 | 1.90 |
| 168 | 67 | 13 | 2 | 129.00 |
| 169 | 67 | 9 | 2 | 229.00 |
| 170 | 67 | 4 | 1 | 12.90 |
| 171 | 68 | 14 | 4 | 4.50 |
| 172 | 68 | 17 | 4 | 7.50 |
| 173 | 68 | 6 | 1 | 9.90 |
| 174 | 69 | 8 | 1 | 34.90 |
| 175 | 70 | 7 | 3 | 19.90 |
| 176 | 70 | 17 | 9 | 7.50 |
| 177 | 70 | 16 | 7 | 6.90 |
| 178 | 70 | 3 | 4 | 8.50 |
| 179 | 71 | 15 | 8 | 1.90 |
| 180 | 71 | 7 | 3 | 19.90 |
| 181 | 71 | 9 | 1 | 229.00 |
| 182 | 72 | 12 | 1 | 349.00 |
| 183 | 72 | 14 | 3 | 4.50 |
| 184 | 72 | 13 | 1 | 129.00 |
| 185 | 72 | 5 | 4 | 2.80 |
| 186 | 73 | 2 | 7 | 3.90 |
| 187 | 73 | 12 | 2 | 349.00 |
| 188 | 73 | 14 | 2 | 4.50 |
| 189 | 74 | 10 | 2 | 49.00 |
| 190 | 74 | 14 | 8 | 4.50 |
| 191 | 75 | 11 | 2 | 189.00 |
| 192 | 75 | 15 | 10 | 1.90 |
| 193 | 75 | 13 | 2 | 129.00 |
| 194 | 76 | 4 | 8 | 12.90 |
| 195 | 76 | 16 | 7 | 6.90 |
| 196 | 77 | 8 | 6 | 34.90 |
| 197 | 77 | 12 | 1 | 349.00 |
| 198 | 78 | 14 | 9 | 4.50 |
| 199 | 78 | 5 | 4 | 2.80 |
| 200 | 78 | 16 | 3 | 6.90 |
| 201 | 79 | 5 | 10 | 2.80 |
| 202 | 80 | 10 | 2 | 49.00 |
| 203 | 80 | 7 | 4 | 19.90 |
| 204 | 80 | 11 | 2 | 189.00 |
| 205 | 81 | 12 | 2 | 349.00 |
| 206 | 81 | 8 | 10 | 34.90 |
| 207 | 82 | 10 | 2 | 49.00 |
| 208 | 82 | 15 | 5 | 1.90 |
| 209 | 82 | 3 | 1 | 8.50 |
| 210 | 82 | 6 | 4 | 9.90 |
| 211 | 83 | 14 | 7 | 4.50 |
| 212 | 83 | 15 | 5 | 1.90 |
| 213 | 84 | 6 | 8 | 9.90 |
| 214 | 84 | 8 | 1 | 34.90 |
| 215 | 84 | 9 | 1 | 229.00 |
| 216 | 84 | 11 | 2 | 189.00 |
| 217 | 85 | 17 | 9 | 7.50 |
| 218 | 85 | 11 | 1 | 189.00 |
| 219 | 85 | 12 | 1 | 349.00 |
| 220 | 85 | 13 | 1 | 129.00 |
| 221 | 86 | 15 | 1 | 1.90 |
| 222 | 86 | 5 | 8 | 2.80 |
| 223 | 86 | 7 | 2 | 19.90 |
| 224 | 87 | 2 | 3 | 3.90 |
| 225 | 87 | 7 | 1 | 19.90 |
| 226 | 87 | 11 | 1 | 189.00 |
| 227 | 87 | 4 | 5 | 12.90 |
| 228 | 88 | 8 | 7 | 34.90 |
| 229 | 88 | 15 | 1 | 1.90 |
| 230 | 88 | 6 | 2 | 9.90 |
| 231 | 89 | 7 | 6 | 19.90 |
| 232 | 90 | 12 | 2 | 349.00 |
| 233 | 90 | 16 | 5 | 6.90 |
| 234 | 90 | 1 | 3 | 1.20 |
| 235 | 90 | 15 | 10 | 1.90 |
| 236 | 91 | 15 | 6 | 1.90 |
| 237 | 91 | 8 | 10 | 34.90 |
| 238 | 92 | 7 | 6 | 19.90 |
| 239 | 92 | 16 | 10 | 6.90 |
| 240 | 93 | 6 | 6 | 9.90 |
| 241 | 93 | 13 | 1 | 129.00 |
| 242 | 93 | 4 | 9 | 12.90 |
| 243 | 94 | 5 | 2 | 2.80 |
| 244 | 95 | 3 | 2 | 8.50 |
| 245 | 96 | 10 | 2 | 49.00 |
| 246 | 97 | 11 | 2 | 189.00 |
| 247 | 97 | 6 | 6 | 9.90 |
| 248 | 97 | 3 | 5 | 8.50 |
| 249 | 98 | 11 | 1 | 189.00 |
| 250 | 98 | 1 | 8 | 1.20 |
| 251 | 98 | 10 | 1 | 49.00 |
| 252 | 98 | 6 | 5 | 9.90 |
| 253 | 99 | 16 | 4 | 6.90 |
| 254 | 99 | 7 | 5 | 19.90 |
| 255 | 99 | 4 | 4 | 12.90 |
| 256 | 99 | 17 | 7 | 7.50 |
| 257 | 100 | 7 | 2 | 19.90 |
| 258 | 100 | 8 | 1 | 34.90 |
| 259 | 100 | 17 | 2 | 7.50 |
| 260 | 100 | 6 | 6 | 9.90 |
| 261 | 101 | 3 | 8 | 8.50 |
| 262 | 101 | 12 | 1 | 349.00 |
| 263 | 101 | 2 | 4 | 3.90 |
| 264 | 102 | 12 | 1 | 349.00 |
| 265 | 102 | 13 | 2 | 129.00 |
| 266 | 102 | 7 | 7 | 19.90 |
| 267 | 102 | 3 | 9 | 8.50 |
| 268 | 103 | 5 | 1 | 2.80 |
| 269 | 104 | 14 | 9 | 4.50 |
| 270 | 104 | 11 | 2 | 189.00 |
| 271 | 104 | 15 | 2 | 1.90 |
| 272 | 104 | 7 | 2 | 19.90 |
| 273 | 105 | 13 | 2 | 129.00 |
| 274 | 105 | 8 | 7 | 34.90 |
| 275 | 105 | 4 | 8 | 12.90 |
| 276 | 105 | 16 | 7 | 6.90 |
| 277 | 106 | 7 | 3 | 19.90 |
| 278 | 107 | 2 | 3 | 3.90 |
| 279 | 108 | 8 | 10 | 34.90 |
| 280 | 108 | 15 | 3 | 1.90 |
| 281 | 108 | 7 | 4 | 19.90 |
| 282 | 108 | 11 | 1 | 189.00 |
| 283 | 109 | 1 | 3 | 1.20 |
| 284 | 109 | 4 | 2 | 12.90 |
| 285 | 109 | 15 | 1 | 1.90 |
| 286 | 109 | 2 | 10 | 3.90 |
| 287 | 110 | 16 | 6 | 6.90 |
| 288 | 110 | 4 | 9 | 12.90 |
| 289 | 110 | 3 | 6 | 8.50 |
| 290 | 110 | 9 | 1 | 229.00 |
| 291 | 111 | 12 | 1 | 349.00 |
| 292 | 111 | 15 | 3 | 1.90 |
| 293 | 111 | 17 | 2 | 7.50 |
| 294 | 112 | 12 | 1 | 349.00 |
| 295 | 112 | 10 | 2 | 49.00 |
| 296 | 112 | 2 | 2 | 3.90 |
| 297 | 113 | 17 | 1 | 7.50 |
| 298 | 113 | 15 | 10 | 1.90 |
| 299 | 113 | 9 | 2 | 229.00 |
| 300 | 113 | 4 | 9 | 12.90 |
| 301 | 114 | 3 | 10 | 8.50 |
| 302 | 114 | 5 | 3 | 2.80 |
| 303 | 114 | 2 | 7 | 3.90 |
| 304 | 114 | 8 | 2 | 34.90 |
| 305 | 115 | 17 | 2 | 7.50 |
| 306 | 115 | 3 | 10 | 8.50 |
| 307 | 116 | 6 | 5 | 9.90 |
| 308 | 116 | 9 | 1 | 229.00 |
| 309 | 117 | 16 | 3 | 6.90 |
| 310 | 117 | 8 | 9 | 34.90 |
| 311 | 117 | 1 | 7 | 1.20 |
| 312 | 117 | 17 | 5 | 7.50 |
| 313 | 118 | 14 | 6 | 4.50 |
| 314 | 118 | 6 | 5 | 9.90 |
| 315 | 118 | 11 | 2 | 189.00 |
| 316 | 119 | 6 | 3 | 9.90 |
| 317 | 119 | 17 | 7 | 7.50 |
| 318 | 119 | 13 | 1 | 129.00 |
| 319 | 120 | 17 | 7 | 7.50 |
| 320 | 120 | 5 | 4 | 2.80 |
| 321 | 120 | 4 | 5 | 12.90 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
Counting and sorting
Task Show FirstName, LastName and each customer’s number of orders (DCount on Orders), most first.
Customers 25 rows, 10 columns
| CustomerID | Company | FirstName | LastName | City | PostalCode | Country | CustomerSince | Regular | Discount |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Noah | Evans | Leeds | LS1 1UR | UK | 28 Feb 2023 | ☑ | 0.1 | |
| 2 | Shaw & Partners | Noah | Davies | Glasgow | G1 1XQ | UK | 5 Feb 2024 | ☐ | 0.03 |
| 3 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 30 Jun 2024 | ☑ | 0 |
| 4 | Olivia | Evans | Bristol | BS1 4DJ | UK | 29 Jun 2022 | ☑ | 0 | |
| 5 | Olivia | Smith | London | EC1A 1BB | UK | 23 Sep 2025 | ☑ | 0 | |
| 6 | Northlight Inc | Mia | Evans | Manchester | M1 1AE | UK | 1 Feb 2025 | ☐ | 0.1 |
| 7 | Bauer Ltd | Ava | Wilson | UK | 14 Oct 2024 | ☐ | 0.05 | ||
| 8 | Lucas | Taylor | Glasgow | G1 1XQ | UK | 2 Jul 2023 | ☐ | 0 | |
| 9 | Jack | Clark | Seattle | 98101 | USA | 7 Nov 2022 | ☐ | 0.1 | |
| 10 | Northlight Inc | Henry | Taylor | Denver | 80202 | USA | 3 Nov 2022 | ☑ | 0.1 |
| 11 | Northlight Inc | Oliver | Johnson | Bristol | BS1 4DJ | UK | 6 Mar 2024 | ☐ | 0 |
| 12 | Henry | Taylor | Chicago | 60601 | USA | 24 Dec 2023 | ☐ | 0 | |
| 13 | Northlight Inc | Noah | Taylor | London | EC1A 1BB | UK | 12 Oct 2022 | ☐ | 0 |
| 14 | Summit Consulting | Mia | Smith | Austin | 78701 | USA | 6 Feb 2022 | ☑ | 0 |
| 15 | Mia | Clark | Austin | 78701 | USA | 9 Mar 2022 | ☑ | 0.05 | |
| 16 | Chloe | Hall | Seattle | 98101 | USA | 4 May 2022 | ☐ | 0.03 | |
| 17 | Market Street Clinic | Sophia | Johnson | Boston | 02108 | USA | 4 Jun 2023 | ☑ | 0 |
| 18 | Roth Legal | Mia | Wright | Manchester | M1 1AE | UK | 23 Sep 2022 | ☑ | 0.05 |
| 19 | Northlight Inc | Grace | Wright | UK | 16 Dec 2023 | ☐ | 0.03 | ||
| 20 | Northlight Inc | Olivia | Brown | Boston | 02108 | USA | 19 Jun 2023 | ☐ | 0.03 |
| 21 | Liam | Brown | Boston | 02108 | USA | 23 Jun 2025 | ☐ | 0.03 | |
| 22 | Bauer Ltd | James | Johnson | Manchester | M1 1AE | UK | 5 Jun 2025 | ☐ | 0.05 |
| 23 | Noah | Wilson | Austin | 78701 | USA | 23 May 2022 | ☐ | 0 | |
| 24 | Market Street Clinic | James | Smith | Bristol | BS1 4DJ | UK | 16 Jan 2022 | ☐ | 0.1 |
| 25 | Northlight Inc | Sophia | Hall | Denver | 80202 | USA | 4 Aug 2025 | ☑ | 0 |
Orders 120 rows, 6 columns
| OrderID | CustomerID | OrderDate | ShippedDate | Freight | PaymentMethod |
|---|---|---|---|---|---|
| 1 | 16 | 30 Apr 2025 | 3 May 2025 | 4.90 | Invoice |
| 2 | 23 | 18 May 2025 | 26 May 2025 | 4.90 | PayPal |
| 3 | 19 | 16 Jul 2026 | 4.90 | Direct debit | |
| 4 | 11 | 31 Mar 2025 | 1 Apr 2025 | 0.00 | Invoice |
| 5 | 6 | 7 Dec 2025 | 9 Dec 2025 | 9.90 | PayPal |
| 6 | 18 | 19 May 2026 | 26 May 2026 | 6.90 | Direct debit |
| 7 | 7 | 15 Jun 2026 | 16 Jun 2026 | 4.90 | Credit card |
| 8 | 20 | 18 Mar 2025 | 19 Mar 2025 | 0.00 | PayPal |
| 9 | 10 | 29 Oct 2025 | 3 Nov 2025 | 0.00 | Direct debit |
| 10 | 7 | 21 Nov 2026 | 4.90 | Invoice | |
| 11 | 1 | 2 May 2025 | 10 May 2025 | 9.90 | Direct debit |
| 12 | 10 | 7 Aug 2025 | 9 Aug 2025 | 0.00 | Invoice |
| 13 | 3 | 17 Sep 2026 | 24 Sep 2026 | 9.90 | PayPal |
| 14 | 16 | 29 Jan 2026 | 1 Feb 2026 | 6.90 | Invoice |
| 15 | 4 | 13 Jun 2025 | 21 Jun 2025 | 4.90 | PayPal |
| 16 | 12 | 3 Nov 2025 | 12 Nov 2025 | 4.90 | Invoice |
| 17 | 9 | 5 May 2026 | 8 May 2026 | 9.90 | PayPal |
| 18 | 9 | 26 Sep 2025 | 2 Oct 2025 | 4.90 | PayPal |
| 19 | 14 | 8 Mar 2026 | 10 Mar 2026 | 0.00 | Credit card |
| 20 | 1 | 2 Apr 2026 | 6.90 | PayPal | |
| 21 | 18 | 17 Nov 2026 | 4.90 | PayPal | |
| 22 | 11 | 27 Jul 2026 | 4 Aug 2026 | 4.90 | PayPal |
| 23 | 12 | 23 Jun 2026 | 28 Jun 2026 | 4.90 | Credit card |
| 24 | 10 | 12 Jan 2026 | 16 Jan 2026 | 0.00 | Direct debit |
| 25 | 1 | 30 Mar 2026 | 31 Mar 2026 | 4.90 | Credit card |
| 26 | 3 | 3 Mar 2025 | 7 Mar 2025 | 4.90 | Invoice |
| 27 | 24 | 9 Mar 2025 | 11 Mar 2025 | 4.90 | PayPal |
| 28 | 1 | 22 Sep 2025 | 28 Sep 2025 | 4.90 | PayPal |
| 29 | 1 | 18 Feb 2025 | 22 Feb 2025 | 4.90 | Invoice |
| 30 | 19 | 13 Oct 2025 | 18 Oct 2025 | 4.90 | PayPal |
| 31 | 10 | 19 Sep 2025 | 25 Sep 2025 | 6.90 | PayPal |
| 32 | 6 | 19 Jun 2026 | 24 Jun 2026 | 4.90 | Credit card |
| 33 | 20 | 16 Jun 2026 | 22 Jun 2026 | 9.90 | Credit card |
| 34 | 13 | 23 May 2026 | 27 May 2026 | 9.90 | Direct debit |
| 35 | 16 | 24 May 2026 | 2 Jun 2026 | 4.90 | PayPal |
| 36 | 14 | 9 Nov 2026 | 14 Nov 2026 | 4.90 | PayPal |
| 37 | 3 | 11 Mar 2026 | 18 Mar 2026 | 9.90 | PayPal |
| 38 | 22 | 2 Jan 2025 | 10 Jan 2025 | 0.00 | Invoice |
| 39 | 12 | 21 Oct 2025 | 27 Oct 2025 | 0.00 | Invoice |
| 40 | 20 | 4 Nov 2026 | 5 Nov 2026 | 9.90 | PayPal |
| 41 | 17 | 29 Mar 2026 | 30 Mar 2026 | 4.90 | PayPal |
| 42 | 13 | 6 Jan 2026 | 8 Jan 2026 | 0.00 | Invoice |
| 43 | 3 | 24 Feb 2026 | 26 Feb 2026 | 4.90 | PayPal |
| 44 | 7 | 21 Sep 2026 | 28 Sep 2026 | 4.90 | Invoice |
| 45 | 2 | 17 Apr 2025 | 23 Apr 2025 | 0.00 | Direct debit |
| 46 | 7 | 27 Apr 2026 | 28 Apr 2026 | 4.90 | Invoice |
| 47 | 3 | 16 Nov 2026 | 6.90 | Direct debit | |
| 48 | 1 | 26 Jun 2026 | 27 Jun 2026 | 4.90 | Credit card |
| 49 | 24 | 29 Apr 2026 | 30 Apr 2026 | 4.90 | PayPal |
| 50 | 1 | 23 Mar 2025 | 28 Mar 2025 | 4.90 | Direct debit |
| 51 | 10 | 28 Jan 2026 | 31 Jan 2026 | 0.00 | PayPal |
| 52 | 22 | 9 May 2026 | 15 May 2026 | 4.90 | Direct debit |
| 53 | 10 | 29 Dec 2025 | 7 Jan 2026 | 0.00 | Credit card |
| 54 | 4 | 17 Oct 2026 | 18 Oct 2026 | 9.90 | Credit card |
| 55 | 24 | 30 Aug 2025 | 31 Aug 2025 | 6.90 | Credit card |
| 56 | 6 | 29 Jan 2026 | 2 Feb 2026 | 4.90 | PayPal |
| 57 | 18 | 10 Dec 2025 | 13 Dec 2025 | 6.90 | Direct debit |
| 58 | 13 | 4 Mar 2025 | 9 Mar 2025 | 9.90 | Invoice |
| 59 | 11 | 29 Nov 2025 | 7 Dec 2025 | 6.90 | Invoice |
| 60 | 9 | 30 Oct 2025 | 4 Nov 2025 | 4.90 | Invoice |
| 61 | 10 | 17 Mar 2026 | 19 Mar 2026 | 4.90 | PayPal |
| 62 | 9 | 14 Jul 2025 | 21 Jul 2025 | 4.90 | PayPal |
| 63 | 8 | 24 May 2025 | 2 Jun 2025 | 0.00 | Invoice |
| 64 | 4 | 29 Sep 2026 | 5 Oct 2026 | 4.90 | Invoice |
| 65 | 10 | 22 Jan 2026 | 27 Jan 2026 | 9.90 | Invoice |
| 66 | 9 | 27 Mar 2026 | 28 Mar 2026 | 9.90 | Credit card |
| 67 | 14 | 11 Sep 2026 | 18 Sep 2026 | 4.90 | PayPal |
| 68 | 4 | 9 Jun 2026 | 16 Jun 2026 | 0.00 | Invoice |
| 69 | 17 | 10 Jan 2026 | 17 Jan 2026 | 9.90 | Credit card |
| 70 | 21 | 1 Apr 2026 | 2 Apr 2026 | 4.90 | Credit card |
| 71 | 15 | 19 Mar 2025 | 21 Mar 2025 | 4.90 | Credit card |
| 72 | 20 | 4 Mar 2025 | 6 Mar 2025 | 4.90 | Invoice |
| 73 | 10 | 24 May 2025 | 9.90 | PayPal | |
| 74 | 8 | 3 Jan 2025 | 4 Jan 2025 | 9.90 | Invoice |
| 75 | 23 | 30 Oct 2025 | 6 Nov 2025 | 9.90 | Direct debit |
| 76 | 22 | 30 Aug 2025 | 3 Sep 2025 | 6.90 | Invoice |
| 77 | 2 | 18 Nov 2025 | 23 Nov 2025 | 6.90 | PayPal |
| 78 | 3 | 22 Dec 2025 | 26 Dec 2025 | 4.90 | Invoice |
| 79 | 21 | 26 May 2026 | 6.90 | Invoice | |
| 80 | 24 | 23 Feb 2026 | 27 Feb 2026 | 4.90 | Direct debit |
| 81 | 2 | 5 Jun 2026 | 6.90 | PayPal | |
| 82 | 11 | 14 Aug 2026 | 6.90 | Invoice | |
| 83 | 21 | 10 May 2026 | 18 May 2026 | 9.90 | Credit card |
| 84 | 13 | 12 Feb 2025 | 19 Feb 2025 | 4.90 | Credit card |
| 85 | 2 | 22 Jan 2026 | 30 Jan 2026 | 4.90 | PayPal |
| 86 | 2 | 31 Oct 2025 | 4 Nov 2025 | 9.90 | Credit card |
| 87 | 6 | 9 Mar 2025 | 17 Mar 2025 | 9.90 | Credit card |
| 88 | 3 | 5 Feb 2025 | 14 Feb 2025 | 9.90 | Direct debit |
| 89 | 17 | 26 Jan 2025 | 29 Jan 2025 | 6.90 | PayPal |
| 90 | 11 | 25 Sep 2026 | 4.90 | Direct debit | |
| 91 | 22 | 23 May 2025 | 1 Jun 2025 | 4.90 | Credit card |
| 92 | 20 | 29 Jan 2025 | 2 Feb 2025 | 0.00 | PayPal |
| 93 | 8 | 16 Jul 2026 | 18 Jul 2026 | 6.90 | Invoice |
| 94 | 2 | 7 Aug 2025 | 10 Aug 2025 | 0.00 | Invoice |
| 95 | 22 | 6 Jan 2025 | 8 Jan 2025 | 6.90 | Credit card |
| 96 | 15 | 15 Dec 2025 | 24 Dec 2025 | 4.90 | Invoice |
| 97 | 6 | 23 Sep 2025 | 30 Sep 2025 | 6.90 | Invoice |
| 98 | 10 | 10 Sep 2025 | 16 Sep 2025 | 0.00 | Invoice |
| 99 | 14 | 10 Jan 2026 | 13 Jan 2026 | 9.90 | Credit card |
| 100 | 16 | 20 Nov 2025 | 24 Nov 2025 | 0.00 | Credit card |
| 101 | 18 | 26 Jul 2026 | 27 Jul 2026 | 4.90 | Credit card |
| 102 | 2 | 15 May 2025 | 9.90 | Invoice | |
| 103 | 4 | 8 Feb 2025 | 15 Feb 2025 | 6.90 | Credit card |
| 104 | 7 | 16 Sep 2026 | 17 Sep 2026 | 4.90 | Invoice |
| 105 | 7 | 26 Jan 2025 | 31 Jan 2025 | 4.90 | Direct debit |
| 106 | 23 | 2 Aug 2026 | 3 Aug 2026 | 6.90 | Direct debit |
| 107 | 13 | 22 Jan 2026 | 26 Jan 2026 | 9.90 | Credit card |
| 108 | 4 | 6 Oct 2025 | 14 Oct 2025 | 4.90 | Direct debit |
| 109 | 10 | 6 Nov 2025 | 9 Nov 2025 | 4.90 | Direct debit |
| 110 | 9 | 17 Oct 2026 | 18 Oct 2026 | 9.90 | PayPal |
| 111 | 23 | 24 May 2026 | 25 May 2026 | 6.90 | Direct debit |
| 112 | 2 | 31 Aug 2025 | 1 Sep 2025 | 9.90 | Direct debit |
| 113 | 20 | 25 Jul 2026 | 28 Jul 2026 | 0.00 | Direct debit |
| 114 | 6 | 24 Nov 2025 | 27 Nov 2025 | 9.90 | Credit card |
| 115 | 8 | 27 Nov 2025 | 30 Nov 2025 | 6.90 | Credit card |
| 116 | 1 | 18 Mar 2025 | 25 Mar 2025 | 0.00 | Direct debit |
| 117 | 9 | 16 Mar 2025 | 19 Mar 2025 | 6.90 | Credit card |
| 118 | 4 | 10 Jul 2026 | 15 Jul 2026 | 0.00 | Invoice |
| 119 | 14 | 23 Jun 2025 | 28 Jun 2025 | 4.90 | Direct debit |
| 120 | 2 | 21 Sep 2026 | 27 Sep 2026 | 4.90 | Direct debit |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
In real Access
- In a query: as a calculated field, for example
Sold: DSum("Quantity","OrderDetails","ProductID = " & [ProductID]). - In a form or report: as the Control Source of a text box, with an equals sign in front:
=DCount("*","Orders","CustomerID = " & [CustomerID]). - In VBA:
DLookup("Category", "Categories", "CategoryID = 3").
Common mistakes
Text criteria without quotes
"Country = " & [Country] gives Country = UK; Access then takes UK for a field name. Correct: "Country = '" & [Country] & "'".
Forgetting the criteria
Without the third argument, DLookup always returns the same value and DSum the total of the whole table.
Domain functions on big tables
Each row runs a lookup of its own. In queries over thousands of rows, a JOIN or a totals query is much faster.
FAQ
DLookup or a combo box?
To pick a value in a form, a combo box is better; to show a dependent value, DLookup. Both come in level 5.
Can the second argument be a query?
Yes, any saved query works as the domain, including a totals query.