If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo Box Not in List function
I have a combo box that lists the option (limited to list) from a table
called tblALLRECCS which has only one field called RECS. How do I write a code in Not In List event of the combo box so that any new entries that is not in the list will be added to the RECS in the tblALLRECCS, after prompting the user with a message box whether he/she wants to add the new item (string) ? Can some one help. Thanks in advance Leo |
#2
|
|||
|
|||
Combo Box Not in List function
Hi -
This is from A2000 - I doubt it has changed much. When you open the event procedure for the NotInList event, you will see that there are two parameters: NewData as String, and Response as integer. NewData contains the data the user entered, and Response indicates how it was dealt with. In your case after you prompted the user, for Yes you would add the new data with SQL, something like this: currentdb.execute "Insert into tblALLRECCS (Recs) Values ('" & newstring & "') " Response = acDataErrAdded if the answer is "No", you might have: me!comboboxname.Undo Response=acdataerrcontinue MS Access will automatically requery the combo box if you added a record. The Help file explains this in more detail (look at the NotInList event), but this will get you started. John Leo wrote: I have a combo box that lists the option (limited to list) from a table called tblALLRECCS which has only one field called RECS. How do I write a code in Not In List event of the combo box so that any new entries that is not in the list will be added to the RECS in the tblALLRECCS, after prompting the user with a message box whether he/she wants to add the new item (string) ? Can some one help. Thanks in advance Leo -- John Goddard E-Mail: jrgoddard AT cyberus DOT ca Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...eries/200911/1 |
Thread Tools | |
Display Modes | |
|
|