aliceapraham . . .
Good enough. Lets see about the combobox!
The code requires [purple]
Microsoft DAO 3.6 Object Library[/purple] to run. To [blue]check/install[/blue] the library, in any code window click [blue]Tools[/blue] - [blue]References...[/blue] In the listing find the library and [blue]make sure its checked.[/blue] Then using the up arrow, [purple]push it up as high in priority as it will go[/purple]. Click OK.
[ol][li]Open the [blue]SalesMan[/blue] form (mainform) in design view.[/li]
[li]Click the [blue]combobox wizard button[/blue]
then click inside the form where you wish to place it. When the [blue]Wizard Dialog[/blue] opens click Cancel.[/li]
[li]Set the following properties for the combobox:
[tt][blue] Column Count [purple]
4[/purple]
Column Widths [purple]
0";1";0";0"[/purple]
List Rows [purple]
25[/purple]
List Width [purple]
1"[/purple]
Row Source Type [purple]
Table/Query[/purple][/blue][/tt][/li]
[li]In the [blue]RowSource of the combobox[/blue], copy/paste the following [blue]SQL[/blue]:
Code:
[blue]SELECT tblCustomer.SalesID, tblCustomer.CompanyName, tblSalesMan.SalesFirstName, tblSalesMan.SalesLastName
FROM tblSalesMan INNER JOIN tblCustomer ON tblSalesMan.SalesID = tblCustomer.SalesID
ORDER BY tblCustomer.CompanyName;[/blue]
[/li]
[li]On the [blue]Event Tab[/blue] select [blue]After Update[/blue] then click the three elipses
just to the right. If a [blue]Choose Builder Dialog[/blue] pops-up select Code Builder.[/li]
[li]Your now in the [blue]Visual Basic Editor[/blue] (VBE) and you should see the event as follows:
Code:
[blue]Private Sub [purple][b][i]ComboboxName[/i][/b][/purple]_AfterUpdate()
End Sub[/blue]
Copy/paste the following code in between the two lines above ([blue]
you![/blue] substitute proper ComboboxName in [purple]
purple[/purple]):
Code:
[blue] Dim Criteria As String
Criteria = "[SalesID] = " & [purple][b][i]ComboboxName[/i][/b][/purple].Column(0)
Me.Recordset.FindFirst Criteria[/blue]
[/li]
[li]Click the [blue]save[/blue] button then hit [blue]Alt+Q[/blue] to return to design view.[/li]
[li]Save, close the form and do your testing . . .[/li][/ol]
[blue]Let me know how ya make out! . . .[/blue]
See Ya! . . . . . .