In Short: How do I refer to a listbox instead of a textbox on the same form?
In detail:
On the form: "Search"
There is a listbox names: QuickSearch which is linked to "Query1"
Below which there is a bunch of text boxes relating to the same query. the idea is to click on an item in the listbox and it will fill in the text boxes. I come to a problem when the Company Name is missing and I am trying to get it to Search by last name if it is missing...
I've been drumming over this porblem for a while now and it was only now I figured out the porblem, only I can't seem to find a solution.
the problem is, Len(Me.CompanyName) Kept returning the number 14, from the msgBox. I then realised why. Instead of filling the text box with the data of the item I just clicked, it filled it in with the next thing on the list with a company name... which has 14 characters in it.
I realised Len(Me.CompanyName) is reading from the text boxes instead of the list boxes! I need to solve this please
.
In detail:
On the form: "Search"
There is a listbox names: QuickSearch which is linked to "Query1"
Below which there is a bunch of text boxes relating to the same query. the idea is to click on an item in the listbox and it will fill in the text boxes. I come to a problem when the Company Name is missing and I am trying to get it to Search by last name if it is missing...
Code:
Private Sub QuickSearch_AfterUpdate()
If Len(Me.CompanyName) Then
SearchByCompanyName (Me.CompanyName)
MsgBox Len(Me.CompanyName)
Else
SearchByLastName (Me![LastName])
MsgBox Len(Me![LastName])
End If
End Sub
I've been drumming over this porblem for a while now and it was only now I figured out the porblem, only I can't seem to find a solution.
the problem is, Len(Me.CompanyName) Kept returning the number 14, from the msgBox. I then realised why. Instead of filling the text box with the data of the item I just clicked, it filled it in with the next thing on the list with a company name... which has 14 characters in it.
I realised Len(Me.CompanyName) is reading from the text boxes instead of the list boxes! I need to solve this please
