funkkube
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
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
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
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
ASKER
no joy..
i defintely think its got something to do with
#Name?
in all the clientid values...
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)?
What is the datasource for your subform? How are it and the main for related (have you set the master/child fields)?
ASKER
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??
what on earth is that all about?
is the PC too fast for access??
ASKER
not used master/child fields..
i had a problem with it..
the primary key is not the first autoneumber field..
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?
Do you have some updating of records occurring in your processing, and if so, do you force the subform to requery?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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!TheNameOfTheSubformCont
Obviously, change TheNameOfTheSubformControl