• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 678
  • Last Modified:

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
0
funkkube
Asked:
funkkube
  • 4
  • 3
1 Solution
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 WarrenCommented:
Try

tempclientid = Me.Parent.ClientID

Alan
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now