From: SAC on
Access 2003

I'd like the user to be able to choose whether to sort a report by one of
two criteria. I have a form with a dropdown box where they make the choice.

Depending on the choice, I'd like to set the caption of the first column of
the report to the choice and likewise set the control source of the first
column's textbox to the appropriate control source.

In the report_open event I am setting:

the recordsource for the report,
the Me.Grouplevel(0).Controlsource
and the label for the columns.

These work OK.

The record source is:

Me.RecordSource = "SELECT tblOrganization.NAME as OrgName,
tblOrganization.ADDRESS, tblOrganization.ZIPCODE FROM tblOrganization ORDER
BY tblOrganization.ZIPCODE;"

In setting the control source for the textboxes, I've tried

Me.txtNAME.ControlSource = [OrgName] but this does not work.

I get the error "Microsoft Office Access can't find the field '|' referred
to in your expression." Runtime error 2465.

What do I need to change?

Thanks for your help.


From: kc-mass on
Assuming that OrgName is in the same table try:
Me.txtNAME.ControlSource = "OrgName"

Regards

Kevin


"SAC" <sac(a)somewhere.com> wrote in message
news:O7VdSGf7KHA.5464(a)TK2MSFTNGP05.phx.gbl...
> Access 2003
>
> I'd like the user to be able to choose whether to sort a report by one of
> two criteria. I have a form with a dropdown box where they make the
> choice.
>
> Depending on the choice, I'd like to set the caption of the first column
> of the report to the choice and likewise set the control source of the
> first column's textbox to the appropriate control source.
>
> In the report_open event I am setting:
>
> the recordsource for the report,
> the Me.Grouplevel(0).Controlsource
> and the label for the columns.
>
> These work OK.
>
> The record source is:
>
> Me.RecordSource = "SELECT tblOrganization.NAME as OrgName,
> tblOrganization.ADDRESS, tblOrganization.ZIPCODE FROM tblOrganization
> ORDER BY tblOrganization.ZIPCODE;"
>
> In setting the control source for the textboxes, I've tried
>
> Me.txtNAME.ControlSource = [OrgName] but this does not work.
>
> I get the error "Microsoft Office Access can't find the field '|'
> referred to in your expression." Runtime error 2465.
>
> What do I need to change?
>
> Thanks for your help.
>
>


From: SAC on
Excellent!!

Do you happen to know why the intellisense dos not show controlsource for an
option to Me.txtName. ??

Thanks for your help.

I really appreciate it.

"kc-mass" <connearney_AT_comcast_DOT_net> wrote in message
news:eYWUDqf7KHA.356(a)TK2MSFTNGP05.phx.gbl...
> Assuming that OrgName is in the same table try:
> Me.txtNAME.ControlSource = "OrgName"
>
> Regards
>
> Kevin
>
>
> "SAC" <sac(a)somewhere.com> wrote in message
> news:O7VdSGf7KHA.5464(a)TK2MSFTNGP05.phx.gbl...
>> Access 2003
>>
>> I'd like the user to be able to choose whether to sort a report by one of
>> two criteria. I have a form with a dropdown box where they make the
>> choice.
>>
>> Depending on the choice, I'd like to set the caption of the first column
>> of the report to the choice and likewise set the control source of the
>> first column's textbox to the appropriate control source.
>>
>> In the report_open event I am setting:
>>
>> the recordsource for the report,
>> the Me.Grouplevel(0).Controlsource
>> and the label for the columns.
>>
>> These work OK.
>>
>> The record source is:
>>
>> Me.RecordSource = "SELECT tblOrganization.NAME as OrgName,
>> tblOrganization.ADDRESS, tblOrganization.ZIPCODE FROM tblOrganization
>> ORDER BY tblOrganization.ZIPCODE;"
>>
>> In setting the control source for the textboxes, I've tried
>>
>> Me.txtNAME.ControlSource = [OrgName] but this does not work.
>>
>> I get the error "Microsoft Office Access can't find the field '|'
>> referred to in your expression." Runtime error 2465.
>>
>> What do I need to change?
>>
>> Thanks for your help.
>>
>>
>
>