A family of Microsoft relational database management systems designed for ease of use.
1. Let's deal with the issue of adding a new item to the list of locations first. This would normally be done by means of code in the combo box's NotInList event procedure, as we've described earlier, but Access does provide a simpler, though more cumbersome for the user, solution. First you need to create a form bound to the locations table and set its Data Entry property to True (Yes). Then in the Data tab of the combo box's properties sheet enter the name of the new form as the List Items Edit Form property. If the user types a new location name into the combo box, they'll be prompted as to whether they wish to edit the items in the list. Answering yes will cause the new form to open at an empty new record, in which they can enter the new location and close the form. The new location will now be included in the combo box's list. So, there is no need for you to keep the locations table open.
- As regards the Sold column in the items table, the usual control for data entry into a Boolean (Yes/No) column is a check box. The 'code' you are referring to is the SQL statement of a query. This is entered in the query designer by switching to SQL view and typing in the SQL statement, or you can do it visually in the query design interface. The SQL statement for a query to return only unsold items would be something like this:
SELECT *
FROM [Items]
WHERE NOT [Sold]
ORDER BY [ItemName];
Conversely, to return only sold items:
SELECT *
FROM [Items]
WHERE [Sold]
ORDER BY [ItemName];
And to return all items, whether sold or unsold:
SELECT *
FROM [Items]
ORDER BY [ItemName];
Note that if you switch back to query design view and save the query Access will change the SQL statement. It will work just the same, however. A query like one of the above can be used as a form's RecordSource property for data entry.