Danielle17
Technical User
Hi - (Using Access 2K)
On one of my forms I am using an option group to change the recordsource of my combo box. The option group has 3 options to chose from "First", "Second" or "Third" each of these representing a different table in the database. Each one is very similiar in design but none are identical.The combo box displays the names and addresses of customers from one of the three tables. Now after the user chooses a table to pick a customer from they will then precede to choose a customer out of the combo box. The info for this customer should be displayed in the text boxes on the form. The only problem is that I cannot directly assign a control source to the text boxes since it will change according to which option is choosen(which table). So logically I thought to put a line of code with the option group which states that the recordsource of the FORM will change to the which ever table is choosen. This is what I put down for the controlsource for the textboxes:
Me.txtPhoneNumber.ControlSource = "PhoneNumber"
This produces an error that goes something like "A macro or function prevents this from happening because the data cannot be saved". The controlsource for the text boxes is going to change, like the reocrdsource for the combo boxes, when one of the options in the group are choosen. I'm at a loss as to where I should be putting the bit of code that states the controlsources for the textboxes. I cannot put it on the OnClick event for the option group because of the error....I need some help fast on this one...it needs to be on the sales manager's desk ASAP....thanx in advance...I can post the code that I'm currently working with.
On one of my forms I am using an option group to change the recordsource of my combo box. The option group has 3 options to chose from "First", "Second" or "Third" each of these representing a different table in the database. Each one is very similiar in design but none are identical.The combo box displays the names and addresses of customers from one of the three tables. Now after the user chooses a table to pick a customer from they will then precede to choose a customer out of the combo box. The info for this customer should be displayed in the text boxes on the form. The only problem is that I cannot directly assign a control source to the text boxes since it will change according to which option is choosen(which table). So logically I thought to put a line of code with the option group which states that the recordsource of the FORM will change to the which ever table is choosen. This is what I put down for the controlsource for the textboxes:
Me.txtPhoneNumber.ControlSource = "PhoneNumber"
This produces an error that goes something like "A macro or function prevents this from happening because the data cannot be saved". The controlsource for the text boxes is going to change, like the reocrdsource for the combo boxes, when one of the options in the group are choosen. I'm at a loss as to where I should be putting the bit of code that states the controlsources for the textboxes. I cannot put it on the OnClick event for the option group because of the error....I need some help fast on this one...it needs to be on the sales manager's desk ASAP....thanx in advance...I can post the code that I'm currently working with.