Syntax Problem in accessing a control on a form - Access97

From: Leonard Priestley (priestly_at_ihug.co.nz)
Date: 03/06/04


Date: Sat, 6 Mar 2004 17:58:27 +1300

I have a main form (frmMain) which includes a subform (frmHost). I am using
the subform to display any one of several forms, selected by using a command
button which sets the form to be displayed as the SourceObject for the
subform. This works fine.

One of the forms to be displayed (frmToDo) is a continuous form with several
fields. Using command buttons, the user can select which field to sort the
data on. I want to preview and print the data from this form, sorted in the
same way as the user has selected for the form. I identify the command
button pressed by assigning a value to a variable (ReportSelect As Integer).
The value of ReportSelect assigned to an invisible textbox (txtRS), to be
picked up by the report.

When I tried to produce and run a report, it became evident that the sorting
of the data would have to be done before frmToDo processed the line:

    DoCmd.OpenReport "rptToDo", acViewPreview

So I added code to the Report Open event, to do the sorting. I began by
picking up the value of txtRS from frmToDo, and then used a Select Case
statement to decide how to sort.

My problem is this: When I work only with frmToDo, and rptToDo, I use this
code to pick up the value of txtRS:

    ReportSelect = Forms!frmToDo.txtRS,

and it all works beautifully. But when I take one step back and try to run
it from frmMain, I cannot get the syntax correct. At present I am looking
at the line:

    ReportSelect = Forms![frmMain].[frmHost].frmToDo.txtRS

Which produces an error message 'Object doesn't support this property or
method'. I have tried removing [frmToDo] and get the same error message.

Can someone put me right on this please
.
Leonard Priestley



Relevant Pages

  • RE: Allowing form combo box to show all records
    ... >> I am building a report tracking database using Access 2003. ... On the main form I have a subform that displays a list of ... >> box wizard to allow me to filter out reports associated with a project and ... >> display the filtered result in the subform. ...
    (microsoft.public.access.formscoding)
  • Re: Read-only user & subforms
    ... In the case of the report, you displayed that message on the main report. ... subform clears and loads its records, and it is not in the desired place. ... >> Read-only permission gives you condition b. ... >> able to get the values and display these correctly either. ...
    (microsoft.public.access.forms)
  • RE: How do I overlay variable items on an imported image used for
    ... number before the main form will even open and the data on the report shows ... shouldn't be too difficult to create a subreport. ... The data that the subreport needs to display is from a subform. ...
    (microsoft.public.access.reports)
  • Re: Help!! Im running around in circles!
    ... A subform will display on the form if it has any records. ... You can have subreports in a report -- they are similar to subforms on ... So I want Access to be able to search all patient ...
    (microsoft.public.access.gettingstarted)
  • Re: Print a field only if value is true
    ... but your data structure is unnormalized. ... show only the problems (exactly what you describe for your report). ... On this tab, is subform "sfrmRoof". ... If a checkbox is left unchecked, ...
    (microsoft.public.access.reports)