Two textboxes bound to the same table

ma09fraga

New member
Local time
Today, 15:22
Joined
Jun 10, 2009
Messages
3
Hello!

I am having a minor problem that I hope you can help me with.

I am no expert at using Access, but I usually manage to solve most of my, minor, problems. This time it is too tough for me though!

I am currently using Microsoft Access 2007. This is how far I have come:
I have made a table with a field, and in the design view I have specified the field’s data type to “number”.

Thereafter I have created a form, in which I have put two textboxes: textbox #1 and textbox #2. My issue is that I want both textboxes to be bound to the same field in the table I made.
I want to add some conditions to these textboxes, so that they function in this way:

- Since textbox number one always will be used by my users, I want the table to always retrieve information from textbox number 1.
- In some situations, my users will write numbers in both textbox 1 and textbox 2. If my users have written a value in both textbox number 1 and in textbox number 2, I want the form to display both values, but I want the table to only retrieve the value from textbox #2.

Is this possible? I have tried everything I can think of, but I just don’t get it.

I would be very grateful if anyone could help me! (I would really appreciate step-by-step instructions, if you are able to do that! J)

Thanks a bunch!
 
My issue is that I want both textboxes to be bound to the same field in the table I made.

So id you you have two text boxes bound the the field, the will both always have the same data. Whatever you type in one text box, will automatically appear in the other text box. Since there is only one field, ther can only be one value, so box text boxes will always be the same.


- In some situations, my users will write numbers in both textbox 1 and textbox 2. If my users have written a value in both textbox number 1 and in textbox number 2, I want the form to display both values, but I want the table to only retrieve the value from textbox #2.

This will never happen (see above). You can't have "the form to display both values" because there is only one field/value!

Maybe it would help if you would explain in more detail what you are needed, not what you you are trying to do.
 
Thank you for the reply!

You seem to have understood my difficulties in a good way, but I will try to explain my problems further.

I am in need of this:

- A textbox where my users can write in a value (a number). This value is a length that they measure manually on an object. Sometimes this value can be outside of the tolerances that is accepted for the object.

This means that my users must adjust the length until it is inside the tolerances, and then measure the same thing once again. Once the length is OK, they are going to write the value into the second textbox (textbox number 2).

When this event of procedures occurs, all I want in my table is the second value - that is the value that is acceptable and inside the tolerances.

Do you understand a little better what I mean now? Please tell me if you want me to describe my issue further, or if you would like to take a look at my form/table.

Thanks a lot in advance!
 
Will you need to store the value form the first test box?

If no, then make text box 1 unbound by leaving the control source blank (no field name)

If yes, then you will have to add an additional field to the table and set the text box 1 to be bound to this other field. The way the two text bound will be bound to separate fields.

Once the length is OK, they are going to write the value into the second textbox (textbox number 2)
Why not just use VBA code to copy the value after it has validated the value to see if it is inside the tolerances. Are you using the After update event of the first text box to check to see if it is "inside the tolerances".

If it were me, I would use a combo box that only allows the user to pick a value that is "inside the tolerances". Tis way you only need one control and no need to copy data between controls (text boxes).
 
It is like this;
My operators must write a value in textbox 1 at all times. It doesn’t matter if the value is inside or outside the tolerances, they must write the value they have measured in textbox 1. Usually, my table will retrieve values from this box.

BUT (and here is the issue),
if the value they have written is outside of the tolerances – the textbox will become red, since I have put in some conditional formatting. This means that my operators must write a new value into textbox 2. If there is a value in textbox 2, I want this value to be put in my table – instead of the value in textbox 1.

So what I’m trying to do is this:
- Always bring values from textbox 1 to the table
- If my operator has written a value in textbox 2, display both values in the form but only retrieve the value in textbox 2 to the table.

I have tried to write some codes in the After update event, but I just don’t seem to understand what I must write in order to get my form right.

Please, give me any ideas you may have. Thank you!
 

Users who are viewing this thread

Back
Top Bottom