Link to home
Start Free TrialLog in
Avatar of funkkube
funkkubeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
Avatar of pique_tech
pique_tech

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).
Avatar of funkkube

ASKER

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
no joy..
i defintely think its got something to do with

#Name?

in all the clientid values...
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)?
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??
not used master/child fields..
i had a problem with it..
the primary key is not the first autoneumber field..
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?  
ASKER CERTIFIED SOLUTION
Avatar of Alan Warren
Alan Warren
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial