see the FAQ section under access general I believe Elisabeth has a posting on this same thing
you basically use the not in list event then a msgbox to ensure they want to add the entry. on confirmation add the entry to the table via sql or DOA or ADO then refresh the list.
all in just a few lines but too late on a Friday to bother thus the referral to the FAQ
Joemiller, when I changed the list property to 'No' it give me this: MS ACCESS can not set the limit ToList to No right now, The first visible column, which is determined by the column widths property, isn't equal to the bound column adjust the column widths property first, and then set the limit to NO. I try it and I lost all my data, so I set it back. I tried changing the column width a number of ways and I still can't get it to work.
The message you are getting is because you have set the source of your combo box to be more than one field, and the field you are storing in your table (an id of some sort i assume) is not the field that you are displaying in the combo box.
there is a simple solution to this.
leave the limit to list property as it is.
near the bottom of the properties box is the on not in list event. use this event to add the new value into the underlying data source of your combo box.
example
I've created a basic two table ordering system as follows:
From the orders table I create a form, using a combo box for the customerID field. The source of the combo box is
SELECT [customerID], [customer] FROM customers
now leave the limit to list to yes, and build some code in the on not in list event as follows:
Private Sub CustomerID_NotInList(NewData As String, Response As Integer)
DoCmd.RunSQL ("INSERT INTO customers (customer) VALUES ('" & NewData & "')"
Response = acDataErrAdded
Me.CustomerID.SetFocus
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.