A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Set Control source at runtime



 
 
Thread Tools Display Modes
  #1  
Old May 7th, 2010, 03:28 PM posted to microsoft.public.access
SAC
external usenet poster
 
Posts: 94
Default Set Control source at runtime

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.


  #2  
Old May 7th, 2010, 04:32 PM posted to microsoft.public.access
Kc-Mass
external usenet poster
 
Posts: 362
Default Set Control source at runtime

Assuming that OrgName is in the same table try:
Me.txtNAME.ControlSource = "OrgName"

Regards

Kevin


"SAC" wrote in message
...
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.




  #3  
Old May 10th, 2010, 03:37 PM posted to microsoft.public.access
SAC
external usenet poster
 
Posts: 94
Default Set Control source at runtime

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
...
Assuming that OrgName is in the same table try:
Me.txtNAME.ControlSource = "OrgName"

Regards

Kevin


"SAC" wrote in message
...
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.





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.