Hi Guys,
I am trying to select a record based on the value of a combo box, I can't use the wizard as I have code that currently lets you select the value and registers for later, I want to then use that value to open a record.
Below is sample code for the selection and combo box, the box is called results just to clarify.
I know this code works but I now what it to open a record when I select the value, any help would be great.
Private Sub Results_Click()
Dim x As Integer
Dim result As String
Dim strSQL As String
For x = 0 To Results.ListCount - 3
If Results.Value > 0 Then
result = Results.Value
strSQL = "SELECT [Customer Name] FROM Customer WHERE [Customer ID] LIKE '*" & str & "*' OR[Customer Name] LIKE '*" & str & "*' OR[Customer Address] LIKE '*" & str & "*' OR[Customer City] LIKE '*" & str & "*' OR[Customer Post Code] LIKE '*" & str & "*'OR[Customer Region] LIKE '*" & str & "*' OR[Customer County] LIKE '*" & str & "*'OR[Customer Country] LIKE '*" & str & "*' OR[Customer Telephone No] LIKE '*" & str & "*'OR[Customer Date of Birth] LIKE '*" & str & "*' OR[Customer Type] LIKE '*" & str & "*'OR[Payment Method] LIKE '*" & str & "*'"
DoCmd.RunSQL (strSQL)
End If
Next
End Sub