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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating combo box 1

Status
Not open for further replies.

cav

MIS
Feb 3, 2000
49
US
I have been requested to create a combo box to list projects since typing the alphanumeric project causes typing errors. So, I now have a combo box on a form with a current list of projects.--- What is the best way to design an easy way for the user to update this box with new projects and delete the old projects. Thanks for your help.
 
First the combo box should be connected to a table not key-in data.<br>
Then have another form where they key in, edit or make changes, directly to the table data.<br>
<br>
Now then your current form is where they pick the combo box.<br>
<br>
OK<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Thanks--That is the direction I was heading but need reassurance. A follow up question... I actually based the combo box not on the projects table but on a projects query from the table so the combo box list would be in ascending order. Is that the best way to create that order?
 
Yes it will work.<br>
you can create a query in the combo box though.<br>
If you use the Wizard it will build a SQL statement in there then if you need to edit it later click the 3 dots in th econtrol source box in properties and it will take you to a query builder grid. so you can click ascending to sort it.<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Here's a standard feature I create on most of my combo boxes: On the NotOnListEvent, ask if the user wants to add a project. If yes, call the Project form (if you don't have one, just use the form wizard on the Project table). Assuming your combo box is bound to a field named ProjectID and your form name is frmProject, here is the code:<br>
<br>
Private Sub ProjectID_NotInList(NewData As String, Response As Integer)<br>
On Error GoTo Err_ProjectID_NotInList<br>
Dim intAnswer As Integer<br>
<br>
intAnswer = MsgBox(&quot;Poject not in table. Edit Project table?&quot;, vbYesNo, vbQuestion)<br>
If intAnswer = vbYes Then<br>
DoCmd.OpenForm &quot;frmProject&quot;, acNormal, , , acFormEdit, acDialog ' opens form <br>
Response = acDataErrAdded<br>
Else<br>
Response = acDataErrContinue<br>
End If<br>
<br>
Exit_ProjectID_NotInList:<br>
Exit Sub<br>
<br>
Err_ProjectID_NotInList:<br>
MsgBox Err.Description<br>
Resume Exit_ProjectID_NotInList<br>
<br>
End Sub<br>
<br>
For this event to be triggered, be sure to set the comb's LimitToList property to &quot;Yes&quot;.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top