mirko
03-14-2008, 01:56 PM
Hi guys,
I have a problem and I would appreciate it if you could help me.
I have a database of clients and transactions and I want to do a search by client name and I want all the transactions by the specific client returned in a form.
I currently have a form which asks for the client name and then another form with a listbox on which I want the transactions to be populated. This is the code I have for the form where I want the transactions to be populated:
Private Sub UserForm_Initialize()
Dim nRecords As Integer
' Populate the listbox.
With LstSelectSurvey
With Worksheets("PropSurveys").Range("A1")
nRecords = Range(.Offset(1, 0), .End(xlDown)).Rows.Count
For i = 1 To nRecords
If .Offset(i, 0).Value = FrmSrcbyClientName.TxtClient Then
.AddItem Worksheets("PropSurveys").Range("A1").Offset(i, 0)
End If
Next
End With
End With
End Sub
FrmSrcbyClientName.TxtClient is the name I am searching for and is generated from the previous form where I do the search.
This code gives me the following error "Object does not support this property or method"
Any ideas on how to tackle this? Thanks in advance for the help!
I have a problem and I would appreciate it if you could help me.
I have a database of clients and transactions and I want to do a search by client name and I want all the transactions by the specific client returned in a form.
I currently have a form which asks for the client name and then another form with a listbox on which I want the transactions to be populated. This is the code I have for the form where I want the transactions to be populated:
Private Sub UserForm_Initialize()
Dim nRecords As Integer
' Populate the listbox.
With LstSelectSurvey
With Worksheets("PropSurveys").Range("A1")
nRecords = Range(.Offset(1, 0), .End(xlDown)).Rows.Count
For i = 1 To nRecords
If .Offset(i, 0).Value = FrmSrcbyClientName.TxtClient Then
.AddItem Worksheets("PropSurveys").Range("A1").Offset(i, 0)
End If
Next
End With
End With
End Sub
FrmSrcbyClientName.TxtClient is the name I am searching for and is generated from the previous form where I do the search.
This code gives me the following error "Object does not support this property or method"
Any ideas on how to tackle this? Thanks in advance for the help!