Problems with auto-populated text boxes

diS

Registered User.
Local time
Today, 03:29
Joined
Jan 16, 2015
Messages
17
Hi!
I have strange issue when creating auto populated text boxes which displays rows from combo boxes.

In one database auto populates works with simple text box Control Source edit "=[ComboName].[Column](NumberOfColumn)".

Somehow same method doesn't wotk in different database: here one time I have to insert VBA code at On change Event:
Me.TextBoxName = Me.ComboName.Column(NumberOfColumn)
and other time it wont work with On change but only with After Update Event (code is same).

Another thing this morning happens was that when I tried to add new record trough form where combo box and tex boxes are located, MS Office suddenly stopped working after selecting combo box selection (with message Microsoft Office has Stopped Working). It is 2013 version.
I got it work after deleting and re-inserting VBA code to autopopulate text box at After Update Event.

Anyone knows what could be a problem?
Thanks!
 
the format for controlsource and vba is different in that controlsources use the square brackets to differentiate between a value and a control or field value.

Somehow same method doesn't wotk in different database: here one time I have to insert VBA code at On change Event:
Me.TextBoxName = Me.ComboName.Column(NumberOfColumn)
and other time it wont work with On change but only with After Update Event (code is same).
It won't because the control value is not updated by the on change event only the text value is updated (which is the first visible column). The control value gets updated between the beforeupdate and afterupdate events so you need to move your code to the afterupdate event

in the change event if you try

debug.print me.combobox.text

you will see the current typed selection in full
 
Thanks for detailed explanation.
On change Event is the tip I found on net but obv. not working. I'll use After Update in future.

What about crashing Access.. I'm afraid to build db and then loose it cause of system error..
 
What about crashing Access..
1. whilst developing, make sure you keep regular backups - I back up at the beginning of each day so I have a latest copy of I can return to - generally one can remember what one has done during the day if something goes wrong.
2. keep version backups. I use a system of version number letter e.g. ver 1c. Before I start any changes I increment the letter. By the time I get to z I have usually incremented the number by one ant which time the letter reverts to a. The number increments when I add a new form or report or some other major change.
3. Probably most important, keep tables in a back end and queries/forms/reports/code in a front end.
4. You code should be designed to avoid crashes with use of error control as applicable
5. Once the application is finished, the front end won't change so just keep a secure copy in case the ones in use become corrupted (unlikely if you compile to an accde) and take regular backups of the backend - level of regularity depends on how much the data changes, but I would suggest a minimum of once a week
 

Users who are viewing this thread

Back
Top Bottom