Full Version: Mainform does not connect with query
UtterAccess Forums > Microsoft® Access > Access Forms
janfolmer
Hi There,
recreated an old database. The structure is the same, the relationships are the same, only some redundant forms and queries were deleted.
Now I have a report (rptRegion), which is based on a query( qryPrintReport). In a mainform, there is a subform frmPrintReport, that has a print button, to print that rptRegion. In that subform are 3 variables: txtStartDate, txtEndDate and Region. Those fields are necessary for the qryPrintReport. I always used this in my previous db:
CODE

Between [Forms]![frmMainMenu]![SubFormArea].[Form]![txtStartDate] And [Forms]![frmMainMenu]![SubFormArea].[Form]![txtEndDate]

Now it doesn't work, while all the actors did not change at all. The query is still the same, same name, the frmMainMenu with the SubFormArea is exactly the same. If I try to print the rptRegion via the frmPrintReport as a normal form (*not as subform) it prompts me for the parameters (because i'ts not in the subform area) but when enterign the variables, it works. So thinking was that there must be something wrong with the MainMenu, but everything works. Where can I look for?
Thanks.
janfolmer
Maybe this is a bit clearer than my explaining
argeedblu
In the example you posted, the menu form has an unbound subform. However, it looks like you are entering the date parameters on the other forms included in the example, not the menu. So your query should refer to the form that has the date selection, not the menu.
Glenn
janfolmer
Hi Glenn,
orrect, the menu form has an unbound subform, this is unbound because the left and right buttons determine which subform will be shown there. If you click in the Main Menu on the button "Print Reports" the form frmPrintReport will be shown as a subform in that unbound area.
I had problems referring queries to that unbound subform so I posted my Q, right here. Find the post here
argeedblu
I can't see any other reason why your code is not working. What values should I select for the parameter choices so that I will get a 'hit' in your sample data?
Glenn
janfolmer
Sorry, yes, Startdate 01-01-2004, End date 01/01/2007 (to capture all possible records). Use the 'Get Figures' button
argeedblu
I tried those dates but it appears that you didn't include the particular report in your upload. It may be a while before I can have a look at this again. The upload has only the regions report.

Glenn
Edited by: argeedblu on Wed May 31 6:42:17 EDT 2006.
janfolmer
I have it working with the "get Figures' Report. I think I m close to finding it,...
argeedblu
Keep us posted.
Glenn
janfolmer
Hi Glenn,
I have found it. The reference was incorrect, after all pretty tricky with referring to controls in a subform.
Thanks
argeedblu
Great! Yes, referencing subform controls is tricky. I'm glad you found the problem.
Glenn
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.