Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating unbound combo box

Status
Not open for further replies.

eloise

Programmer
Jan 31, 2002
20
0
0
US
Hi There

I have an unbound combo box on a complex form that contains a list of clients. I have a text box, where by i can enter a new client, press the save button and the client combo box is refreshed. The problem is i want the combo box to be refreshed and display the new clients name and not a blank line. I do not want to be forced to select the client from the list. Please help. Thanks in advance
 
I think the solution to your problem could even serve to save you space on your 'complex form'

In the combo box set the LimitToList parameter to Yes

In the On_Not_In_List event you then place the code that currently runs from your 'Save' button.

Private Sub cboClient_NotInList(NewData As String, Response As Integer)

Save button code in here
NewData contains the string that you've just typed as the new client.
Response needs to be set as :-
Response = acDataErrAdded

End Sub

Then you return with the new value displayed in the combo box. QED.

You can now do away with the textbox control and the button as they are not needed any more.

( If the data you need to enter is complex, eg. Client, Address, Post Code, PhoneNo etc then create a pop-up form bound to the client table in AddNew mode and put the FormOpen action in the On_Not_In_List event and get the popup forms OnUnload event to return the combo's bound column data to the combo as the popup form closes. )


'ope-that-'elps.

G LS

 
Thank you, I applied your solution and it worked a treat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top