Autofill Form Error 13 Type Mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a code to autofill a form once a combo box has been selected.
In the combo box I have the column cout set to 12 for all the field types. I
have also set the default value of the combo box to "". I have all the
autofill fields set as unbound. I have the combo box bound to the 1 column.
However when I select the name in the combo box I get an error.

Error 13
Type Mismatch

All but (1) field types that are being assigned to the unbound are is an
Long Integer autofill. Would that create the probelm. I tryed to see if it
was necessary to Dim them all as a string. But that did not work. Can
someone tell me what is wrong. When I tryed to debug it I still got the
error message on a field that was not the Long Integer autofill.

Here is the string:

Dim KeyContractor As String
Dim Address As String
Dim City As String
Dim St As String
Dim Zip As String
Dim Contract_Person As String
Dim MainPhone As String
Dim FaxNumber As String
Dim Revd As String
Dim Cost_Code_Trade As String
Dim Supplier As String
Dim Status As String


Me.KeyContractor.Value = Me.Contractor(1)
Me.Address.Value = Me.Contractor(2)
Me.City.Value = Me.Contractor(3)
Me.St.Value = Me.Contractor(4)
Me.Zip.Value = Me.Contractor(5)
Me.Contact_Person.Value = Me.Contractor(6)
Me.MainPhone.Value = Me.Contractor(7)
Me.FaxNumber.Value = Me.Contractor(8)
Me.Revd.Value = Me.Contractor(9)
Me.Cost_Code_Trade.Value = Me.Contractor(10)
Me.Supplier.Value = Me.Contractor(11)
Me.Status.Value = Me.Contractor(12)
 
When you say autofill, do you mean it is an AutoNumber data type in your
table? I don't really quite understand what you are saying. What is the
contractor lable? I did not see it in your original post.
You said your column count is 12; therefore, the highest column number you
can use is 11, so again, I am lost. Sorry, but I need some more info here.
I'll be happy to help sort this out.
 
Klatuu,

What I mean by Autofill it this:

I have a table where I store all my contact information for our suppliers.
I have created a field that is used to identify each suppliers by a number.
This number is a AutoNumber field type. That way I don't have to assign a
number the program does it for me. That Autonumber links may tables together
for the contact information. I the form I have created I use a combo box to
list all the suppliers in the names where it is stored in a table called
tbcontracotor. In this table there are 12 fields that I want to autofill
once you select the correct contractor by the combo box. So when you select
"Joe Cleaner" in the combo box the rest of the fields in the form autofill
with the correct contact information IE; phone, fax, address, e-mail, etc...

In the combo box the fields go from 0-12 including the field that I am
pulling the data of the supplier’s name.

But I am still getting the error message. Does that help? I would greatly
appreciate your help I am very new at this.
 
Doh! I should have seen this first thing. It is a syntax problem.
Me.KeyContractor.Value = Me.Contractor(1)
is missing the column designator:
Me.KeyContractor.Value = Me.Contractor.Column(1)
etc.
 
Klatuu,

I am sorry that I have not gotten back to you sooner but I had another
project to work on. But I have changed the expression to add the column
designator. But now I get a new error. Compile Error: Method or data member
not found (461). I am not sure what it can not find. I have check the
spelling and nothing is spelled wrong. One thing I am not understanding is
that should the textbox where the data will be shown once the expression
works should it be Unbound or should I have the expression in the control
source of the textbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top