I have a table with the fields: ID, SerialNumber, Capacity, Accuracy.
I display between 1 and 4 records in a datasheet subform based on the serial numbers.
Now I want to display every Capacity
- above 5000kg as tonnes(divide by 1000 and add " t")
- between 5000kg and 0.5kg as kg(keep the number and add " kg")
- Below 0,5kg as grams(multiply by 1000 and add " g")
But, I want all the values to stay in kg in the table. So I only want to change this when I display them.
The last thing I tried was this: I added an extra column named txt_Capaciteit, used this as the 'main' column in which the data is stored and then add "kg" in an empty column. But this changes all the columns in Capaciteit to the column selected in the column txt_Capaciteit.
Me.Capaciteit = Me.txt_Capaciteit & " kg"
Edit:
I also tried to use an expression as control source. By using two if statements, then divide or multiply and at last add "t","kg, or "g". Even though this worked, it made the form very slow and laggy (took 1-2 seconds to load 4 fields)
Can someone please tell me what I'm doing wrong? Thanks in advance!
CapacityAdjusted, asShort Text. Then, have anAfter UpdateandAfter Insertmacro that updates this field using the logic you described. Unfortunately, I'm not familiar enough with Access data macros to provide a full answer (too bad you're not using SQL Server as your backend---I could be of more help there). - Zack