simple question about combobox/textbox

HabibValil

New member
Local time
Tomorrow, 01:59
Joined
Jan 20, 2022
Messages
17
Hello everyone,
I am new to access. I have a table with some fields. I created a form for that table in Add mode so that I can add records to the table. in the form I have a combo box with values I manually entered. suppose the values are "a" , "b", "c". I have set the control source of the combo box to "Letters" field in my table.
Now when I choose "a" in combo box it goes directly to the "Letter" field in the table. But, I want to do some manipulation on the selection of the combo box (for example I want to change it to Capital A) and then store it in my table. How can I do that?
In othe words: Generally how can I make some manipulations and calculations on the selected value of combo box and then save the results of those calculations in the desired field in table?
 
If you want capital letters, then supply capital letters.
Else convert yo uppercase in the afterupdate event of the combo
 
If you want capital letters, then supply capital letters.
Else convert yo uppercase in the afterupdate event of the combo
Capitalization was an example. what if combo box values are numbers, and based on selected number, I want to save "square of that number" in my table. If I do it in the afterupdate event, the result of the afterupdate event will be shown in the form. but I dont want that to be shown in the form.
 
Hi. Welcome to AWF!

Unless you have a "definite" rule of what your "manipulation" will do, it's hard to give you any specific advice. If you want to display something else on the form but store another thing in the table, then you might have to use an unbound textbox.

PS. If you want to "remember" what you displayed for a specific value in the table, then you might have to use two separate columns in your table: one for the form and the other for the table.
 
Not a good idea to store calculated values in a table. Just store the raw data. From that raw data, you can do what ever you want with it. I think you need to describe the big picture on what your database does in general.

Combo boxes are typically used to display pre determined choices to eliminate user data entry errors. It's not clear why you would enter different data types into one field. That's not how databases work. Pick numbers when there needs to be numerical calculations or text values when there doesn't.
 
No, I mean don't store it. You can always calculate on the fly using a form or report. Do a search on calculated fields.

There are exceptions to that rule depending on the type of database we're talking about.

Yes, you have to store your formula for the calculations needed but not the result. SQL queries on the raw data can certainly be used to store the formula.
 
Last edited:
Capitalization was an example. what if combo box values are numbers, and based on selected number, I want to save "square of that number" in my table. If I do it in the afterupdate event, the result of the afterupdate event will be shown in the form. but I dont want that to be shown in the form.
So you save the amendment value?
If you amend and the user does not see it, then when they next look at the record Voila, the value is uppercase or squared??
Confusing as hell I would have thought?
 
So you save the amendment value?
If you amend and the user does not see it, then when they next look at the record Voila, the value is uppercase or squared??
Confusing as hell I would have thought?
sorry for confusion. squared and uppercase were two separate examples I made trying to describe my question. Next time I will exactly describe the actual problem.
 
It does not matter what the amendment is. My point was the next time the user sees that value they entered, it has changed?
The idea of storing the actual value and the formula for the change, so you can regenerate whatever it is you want to see sounds a better idea?
 

Users who are viewing this thread

Back
Top Bottom