1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| Private Sub Form_Load()
Dim req As String
Dim temp As String
Dim rst As Recordset
temp = InputBox("Please type the Account Type", "Acount Type")
req = "SELECT Customers.ID, Customers.[Company Name], Customers.[Industry Type], Customers.[Acount Type], Customers.[Address L1], Customers.[Address L2], Customers.[Address L3], Customers.[Address L4], Customers.PostCode, Customers.City, Customers.Country, Customers.Website, Customers.[E-Mail], Customers.Fax, Customers.[Phone 1], Customers.[Phone 2], Customers.Source, Customers.Description, Customers.Currency, Customers.[Account Manager], Customers.[Product interest], Customers.Actions " & _
"FROM Customers " & _
"WHERE (((Customers.[Acount Type]) LIKE '*" & temp & "*'));"
Set rst = Application.CurrentDb.OpenRecordset(req)
If Not rst.EOF Then
rst.MoveFirst
Do
If Not IsNull(rst![Company Name]) Then
temp = rst![Company Name]
Else
temp = "[vide]"
End If
If Not IsNull(rst![Acount Type]) Then
temp = temp & " " & rst![Acount Type]
Else
temp = temp & " [vide]"
End If
If Not IsNull(rst![Industry Type]) Then
temp = temp & " " & rst![Industry Type]
Else
temp = temp & " [vide]"
End If
If Not IsNull(rst![Phone 1]) Then
temp = temp & " " & rst![Phone 1]
Else
temp = temp & " [vide]"
End If
If Not IsNull(rst![City]) Then
temp = temp & " " & rst![City]
Else
temp = temp & " [vide]"
End If
If Not IsNull(rst![Country]) Then
temp = temp & " " & rst![Country]
Else
temp = temp & " [vide]"
End If
List4.AddItem temp, List4.ListCount
rst.MoveNext
Loop Until rst.EOF
End If
Set rst = Nothing
End Sub |
Partager