Runtime Error 2424 expression u entered has a field,control or property name the Access cant find

Hi

I have a combp box that looks up Client Names..
On change it chages the Record Source values in the form of a sql staemnet to bring up relevent records on a subform..

It brings them up ok so fantastic..

I have a combo box on the subform that looks up relevent answers to the question that the use can choose from..
This is the code..

Dim tempclientid As Integer
Dim tempQuestionID As Integer
Dim tempsql As String


tempclientid = ClientID
tempQuestionID = questionsID

tempsql = "SELECT [Export StockQA].AnswerValue FROM [Export StockQA] WHERE (([Export StockQA].ClientID)=" & tempclientid & ") AND (([Export StockQA].QuestionsID)=" & tempQuestionID & ");"
Debug.Print tempsql


[Combo8].RowSource = tempsql


This subform works 100% when its not a subform..
When it becomes a subform and I click in the combobox to get the relevent answers it comes up wiht the error...

Can anyone help?
mat
funkkubeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pique_techCommented:
I *think* what's happening is:

When the form becomes a subform, all the references in code are interpreted in relation to the parent form.  So I think your last line
     [Combo8].RowSource = tempsql
should be
     Me!TheNameOfTheSubformControl.Form![Combo8].RowSource = tempsql

Obviously, change TheNameOfTheSubformControl to the name of the subform control on your main form (the name that shows in Properties when you have the MAIN form in design mode and click once on the area of the subform).
0
funkkubeAuthor Commented:
Hi

I will try that but here is some more info...

the subform is in datasheet view and I have hidden the clientid and questionid columns..
i unhid them and this #Name?  was what was in all the clientid fields in all the records..
it is bringin up the correct records but the clientid is going funny..

any ideas??
i will try ur suggestion ptech
0
funkkubeAuthor Commented:
no joy..
i defintely think its got something to do with

#Name?

in all the clientid values...
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

pique_techCommented:
Hm....yeah, my guess above didn't quite pan out.  (Should have tested first, huh?)

What is the datasource for your subform?  How are it and the main for related (have you set the master/child fields)?
0
funkkubeAuthor Commented:
i put a msgbox in to see where it was falling over and its ok now?????
what on earth is that all about?
is the PC too fast for access??
0
funkkubeAuthor Commented:
not used master/child fields..
i had a problem with it..
the primary key is not the first autoneumber field..
0
pique_techCommented:
One more hunch (you'd think I'd learn, already being wrong once on this question....)

Do you have some updating of records occurring in your processing, and if so, do you force the subform to requery?  
0
Alan WarrenApplications DeveloperCommented:
Try

tempclientid = Me.Parent.ClientID

Alan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.