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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|