Query not recgonising form

LB79

Registered User.
Local time
Today, 10:18
Joined
Oct 26, 2007
Messages
505
Hello,

Im having a problem with a sub form that I cant quite figure out.
I have a cboBox on a sub form which is ready by a query and provides the result.
If I run the query, only having the subform open, its fine, but if I have my main form open, and the sub form open in the main form, the query wont recognise the cboBox and debugs.

Does anyone know whats going on here?
Thanks
 
you most likely are running the query code from the subform or something. at any rate, the code you are using to requery is probably incorrect. post it and someone will give you an answer i'm guessing.
 
Thanks for you attention... this is the VB code I am using in the subform.
The cmd button is also in the subform.

Private Sub PMAcmd_Click()
DoCmd.OpenQuery "Query1"
End Sub
 
I see...

Thanks I will take a look at your link :)
 
post back if questions. :) or post the DB and someone may have time to look.
 
Hello again... I not having much luck understanding this problem... Im still quite novice at all this.
What is the reason for the subforms functions (cmd) not being recognised by the query when its view through a parent form? Do you know if there is an example of a very simular problem to this that I can look at?

Thanks
 
i am not sure, but if you upload the database with the a few jpegs attached to point the problem out, i will give it a try and fix it for you.
 
Thanks for the suggestions but ive solved it now. I just needed to make the reference in the query more detailes. ie
[Forms]![Parent]![Child].[Form]![cbo]
 
Hello,

I had a problem refering a query to a subform a whol ago which was resolved. But now I have another problem - refering to a subform within a subform.

Ive tried a number of ways (I thought ths mort obvious being):
[Forms]![Parent]![Child]![Child].[Form]![lst]
But apparently not. Can anyone help me with this reference?

Thanks
 
Hello,

I had a problem refering a query to a subform a whol ago which was resolved. But now I have another problem - refering to a subform within a subform.

Ive tried a number of ways (I thought ths mort obvious being):

But apparently not. Can anyone help me with this reference?

Thanks
Perhaps this might work:
[Forms]![Parent]![Child]![Form]![Child].[Form]![lst]
 
Referring to controls on subforms or nested subforms from queries and reports has always been a contentious issue. Apart from the obvious syntax being coded correctly the queries become isolated to the particular form or subform. If you want to use the same query from elsewhere you have to replicate the query with difference referring sources.

I coverd this issue quite a while ago. anyway for those of you that have not picked up on this thread this is best method I have found for overcominng the issued raised above and allows far greater flexibility.

Link

David
 
Hi again...

WIS - Thanks... I tried that but it still doesnt work.

DCLARKE - thanks also but I cant see how this tutorial relates to linking a subform within a subform to a query.
 
The whole point is passing a value from a form/subform to a query using a public variable that is obtained by functions.

Lets assume you click on your continuious sub/subform on a particular line by using the on current event of the sub/subform you can pass the control contents to the public variable, which inturn is read by the query.

Now lets say you use that same subform in a totally different mainform you would need two queries one for mainform A and one form mainfomr B. Using my method you would only use one query for both sources. If you read it more closely (as well as my name) you may just pick up on what it is doing.

David
 

Users who are viewing this thread

Back
Top Bottom