Datasheet view textbox fills with same value for every record

cnstarz

Registered User.
Local time
Today, 06:13
Joined
Mar 7, 2013
Messages
89
Some background: I have a subform that is displayed in datasheet view, with an unbound textbox (field1) whose sole purpose is to pass the date and time entered into it to field2 (hidden, bound), and also display that info in this format: ddhhnn"Z" mm yy. The inputmask for field1 is 000000"Z ">LLL\00 which forces the user to enter the date/time using the ddhhnn"Z" mm yy format. I use field1's AfterUpdate event to convert its contents into a format (dd/MMM/yy hh:mm) that field2 can easily recognize as a date and time.

My problem: The only way I've figured out to get field1 to display field2's date and time is to use the subform's OnCurrent event:

Code:
Me.field1 = Format([Field2], "ddhhnn""Z ""mmm yy")

However, by doing that, whenever I click on a record's row the entire field1 column populates with the current record's field1 value. So, if I click on record 2's row, the entire field1 column populates with "101200Z JUN14" for every record. If I click on record 3's row, the entire field1 column populates with "111232Z JUN14" for every record. And so on and so forth.

Does this make sense? How can I stop field1 from populating with the same value for every record?
 
Why can't you use the AfterUpdateEvent instead? If for some reason you have to store the format of field1 and convert for field2, then use a separate field to store that value, then populate field2 with it.

HTH
 
This is what happens with unbound controls in a form showing multiple records. You only have ONE and the same control, so long as it is unbound. Change your tactic or add a column to your table and bind it.
 
Yeah I figured that's why it was happening. As much as I dont really like it, I ended up making another column in my table to hold the inputted text so that the field could be bound to something.
 

Users who are viewing this thread

Back
Top Bottom