When fields can't be autopopulated.. (1 Viewer)

Cicak

Registered User.
Local time
Today, 11:19
Joined
May 20, 2008
Messages
31
Version of Access used: 2003
Hi,

I have a form containing information about orders. The fields related to the supplier company info are autopopulated (e.g. SupplierName, Salesrep), based on the company number (a primary key) that is entered. I am using a combo box for the CompanyInfoTable. The row source of this combo box is a query that includes the fields to be autopopulated, so that the unbound text boxes can have their control sources set to the relevant column of the query. If a particular company has not yet been encountered during the data entry process, the company number (and details) would not be in the CompanyInfoTable.

Is it possible to allow the user to enter the information about this company into the text boxes that were supposed to be autopopulated (but can't because the company hasn't been stored so the linking field of "CompanyNumber" is not available)? When I try typing into these text boxes, nothing appears and at the bottom of the window a message reads "Control can't be editted, it's bound to the expression 'CompanyNumber.Column(2)'."

Sorry if this issue has been raised previously. I tried searching the forums and Google, and leant how to implement the autopopulate function, then got stuck here. :confused: Please tell me if more information is required.. Any help is greatly appreciated!

Thanks in advance :)
Warmest regards.
 

neileg

AWF VIP
Local time
Today, 19:19
Joined
Dec 4, 2002
Messages
5,975
It's probably possible (almost anything is possible) but it's going to be complex. If it was me, I would pop up a form to capture the new company info, refresh the combo box and let the text boxes autopopulate. Same amount of work for the user, almost as elegant but easier to implement.
 

missinglinq

AWF VIP
Local time
Today, 14:19
Joined
Jun 20, 2003
Messages
6,420
Version of Access used: 2003
The row source of this combo box is a query that includes the fields to be autopopulated, so that the unbound text boxes can have their control sources set to the relevant column of the query.

The Control Source of the textbox should not be bound to the column of the combobox, which the message "Control can't be editted, it's bound to the expression CompanyNumber.Column(2) indicates is happening, but rather the value of CompanyNumber.Column(2) should be assigned to the textbox, with code in the combobox's AfterUpdate event something like

Me.TextboxName = Me.CompanyNumber.Column(2)

This way the data in the textbox can be edited or entered if the box is empty.
 

neileg

AWF VIP
Local time
Today, 19:19
Joined
Dec 4, 2002
Messages
5,975
You're correct 'linq but the text boxes aren't bound to anything. Editing the text there isn't going to achieve anything.
 

missinglinq

AWF VIP
Local time
Today, 14:19
Joined
Jun 20, 2003
Messages
6,420
According to the error message

"Control can't be editted, it's bound to the expression 'CompanyNumber.Column(2)'."

the textbox is indeed bound to something! Which is why it can't be edited.
 

Cicak

Registered User.
Local time
Today, 11:19
Joined
May 20, 2008
Messages
31
Hi neil and missinglinq,

Thanks for your responses! :D

It's probably possible (almost anything is possible) but it's going to be complex. If it was me, I would pop up a form to capture the new company info, refresh the combo box and let the text boxes autopopulate. Same amount of work for the user, almost as elegant but easier to implement.

Thanks I will try this.

Regarding whether it is bound, sorry for not being very clear, I'm not very familiar with the exact terminology. What I meant was that I created them as unbound text boxes and then assigned each the value of the relevant column of the query.. Is doing this ok?
 
Last edited:

Cicak

Registered User.
Local time
Today, 11:19
Joined
May 20, 2008
Messages
31
Me.TextboxName = Me.CompanyNumber.Column(2)
Thank you very much for the suggestion! :)
Hmm. When I use this method the text boxes can be editted but the changes made in these textboxes are not saved to the actual records in the table.. Does this have to do with whether the text boxes are bound controls? If so, should I make them bound to the fields they are supposed to fill/to pull their values from? How should I go about doing this, taking into account that they are from a different table from the rest of the fields?

Thanks :D
 

Users who are viewing this thread

Top Bottom