retreive record from combobox selection

grane236

Registered User.
Local time
Tomorrow, 04:19
Joined
Nov 19, 2012
Messages
15
Hello,

I have read about 2 dozen posts on this and it appears simple. Yet my code fails every time.

I have 2 tables with data. I have a form with multiple tab pages.
The controls on the first tab page all come from the first table.

I have a drop down "Choose or Enter Business Name" which lists the business names in the first table.

I want to populate the rest of the form based on the business name chosen.

My code:
Private Sub BusinessName_AfterUpdate()
Dim rst As DAO.Recordset
Dim strSearchName As String
Set rst = Me.Recordset
strSearchName = (Me!BusinessName)
rst.FindFirst "[Business Name] = " & strSearchName
If rst.NoMatch Then
MsgBox "New Business?"
End If
rst.Close
End Sub

Could someone please tell me what Im doing wrong? This is straight from a microsoft example.

Thankyou.
 
Thanks John,

I did see this as an alternative method however having about 20 fields to autopopulate I figured it wasnt the best way to do it.

I simply want all the records from Table one based on the selected item from my combobox. Simply not proving to be the right word.
 

Users who are viewing this thread

Back
Top Bottom