Compile Error: With AutoFill a Form

jeran042

New Member
Joined
Jun 9, 2016
Messages
23
Good afternoon all,

I am getting the following error message when using my combo box to auto fill some fields on my Access 2007 form, "Compile Error: method or data member not found. The cbobox has an embedded query behind it that pulls (correctly from 2 different tables) all the information I am looking for. The first 4 fields are pulled and filled correctly, when I added the fifth field (from a third table) I get the error message. below is the code that I am using:

Code:
Private Sub cboVendor_Number_Change()    Me.Vendor_Name = Me.cboVendor_Number.Column(1)
    Me.Assigned_To = Me.cboVendor_Number.Column(2)
    Me.Notes_tblVendor = Me.cboVendor_Number.Column(3)
    Me.Notes_tblVendor = Me.cboVendor_Number.Column(3)
    Me.AVAILABLE_SOURCES_tblEFT = Me.cboVendor_Number.Column(7)
End Sub

Not sure why "
Me.Notes_tblVendor = Me.cboVendor_Number.Column(3)" works identifying the third column a second time in the query, but it works.

What Can I try? And is there a better way to go about this?

Thank you,
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
it means you dont have 7 columns.
did you count correctly?
(remember vb count starts at zero. cbo.col(7) is the 8th column)
 
Last edited:
Upvote 0
No, the "Me.Vendor_Name = Me.cboVendor_Number.Column(1)" i actually the second column, the count is correct. Even the "Me.cboVendor_Number.Column(7)" returns the value I want in the field, but I am getting the error. I have tried error handling: on error goto 0 and on error resume next with no luck,

Thank you for the suggestion,
 
Upvote 0
The data member that is not being found is probably Me.AVAILABLE_SOURCES_tblEFT
Check your spelling for the form control name.
For my own enlightenment, what is the reason for repeating the column 3 line?
If my suggestion is not correct, which part of the code line is being highlighted when the error is raised?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,253
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top