run-time error '1004' application-defined or object-defined

josros60

Registered User.
Local time
Yesterday, 16:11
Joined
Mar 10, 2011
Messages
73
Every time i search for customer name i get this error:

run-time error '1004' application-defined or object-defined error excel 2013.

here it's the code:

Code:
If ComboBox1.Value = "" Or ComboBox1.Value = "-" Then
MsgBox "Choose a Filter Field", vbExclamation
ComboBox1.SetFocus
Exit Sub
End If
For a = 1 To 12 ' Clear textboxes(1-12)
Controls("textbox" & a) = ""
Next
With ContactForm
.Clear
.ColumnCount = 12
.ColumnWidths = "92;65;110;65;65;35;40;65;65;115;150;65"
End With
Call Main 'Progress Bar

deg2 = TextBox13.Value
Select Case ComboBox1.Value
Case "Customer"
For sat = 2 To Cells(65536, "A").End(xlUp).Row
Set deg1 = Cells(sat, "A")
If UCase(deg1) Like UCase(deg2) & "*" Then
ContactForm.AddItem
Cells(sonsat, 1) = TextBox1.Text  '(Customer) A
Cells(sonsat, 2) = TextBox2.Text  '(Contact Name)B
Cells(sonsat, 3) = TextBox3.Text  '(Email) C
Cells(sonsat, 4) = TextBox4.Text  '(Address)D
Cells(sonsat, 5) = TextBox5.Text  '(City)E
Cells(sonsat, 6) = TextBox6.Text  '(Province/State)F
Cells(sonsat, 7) = TextBox7.Text  '(Zip/Postal Code)G
Cells(sonsat, 8) = TextBox8.Text  '(Country)H
Cells(sonsat, 9) = TextBox9.Text  '(Phone)I
Cells(sonsat, 10) = TextBox10.Text '(Contact Name, C.C.)J
Cells(sonsat, 11) = TextBox11.Text '(Email C. C.)K
Cells(sonsat, 12) = TextBox12.Text '(Contact Name 2)L
'Cells(sonsat, 16) = TextBox17.Text '(Contact Email 2)M
'Cells(sonsat, 17) = TextBox18.Text '(Manager) N

s = s + 1
End If: Next

give the above error and highlight this line in yellow:

Code:
Cells(sonsat, 1) = TextBox1.Text  '(Customer) A

thank you
 
Does so sat have a value?
When the code stops here,hover the cursor over the word sonsat, and it will tell you the value.
 
not sure where this is coming from, but in Access, the .text property is only available when the control (Textbox1 in this case) has the focus

try removing .text from your code or if you really want to specify the default property, use .value instead
 

Users who are viewing this thread

Back
Top Bottom