I need to save in a table an information that is not bounded on a field in the table

robert_anisoiu

Registered User.
Local time
Today, 08:47
Joined
Oct 27, 2010
Messages
10
Hello,

I have a form where, when I select an item from the combobox, a textbox is filled with [comboboxname].[column](3). I set up the control source of the textbox with [comboboxname].[column](3)

Because this information can change during the time, I need to save it in a table as it is at the moment of selection.

I tried to execute an "insert into" command but only the bounded fields are saved.

Assume that the textbox name is "TxtAp" and the combobox name is "CmbTitle". In the fourth column of the CmbTitle is the price. The control source of TxtAp is "=[CmbTitle].[Column](3)". The price appears in TxtAp when I select a title from CmbTitle but when I try to execute the INSERT INTO command, the price is not written in the table.

I tried like this:

Dim LTxtAp As Single

LTxtAp = Me.[CmbTitle].[Column](3); nothing
LTxtAp = Me.TxtAp; nothing
LTxtAp = Me.TxtAp.Value; nothing

Any ideea, please?
Regards,
Robert
 
Send a short example of your MDB, (access 2000 or 2002-2003).
 
Ok, I'll try to explain.
1) The field "TxtAp" link with the field in the table, (Control source).
2) Put the SUB (Event) ont the field "CmbTitle", After Update.
In the Sub write this code:
Me.TxtAp = Me.CmbTitle.Column (3)
Also, put the Enabled (porperties) = No on the "TxtAp" field.
It must work.
 
Ok, I'll try to explain.
1) The field "TxtAp" link with the field in the table, (Control source).
2) Put the SUB (Event) ont the field "CmbTitle", After Update.
In the Sub write this code:
Me.TxtAp = Me.CmbTitle.Column (3)
Also, put the Enabled (porperties) = No on the "TxtAp" field.
It must work.

I tried exactly like you said.

If I remove the CmbTitle.Column (3) from the ControlSource of TxtAp and I put this in AfterUpdate event of CmbTitle, the price is no more displayed when I select a title from combobox and I move focus on the next object. In this case, even if I set the ControlSource of TxtAp on the field from the table, when I save, nothing is written in the field.

Something does not go well.
 
You have to have 4 column in your Combo Box.
 
The problem is solved!

When I mad the combobox with 4 fields(columns) in query I set up the Column Width to 0, except the column that I wanted to be displayed. When I changed and I gave 3 cm to each column he started to fill my textbox. Weird!
 

Users who are viewing this thread

Back
Top Bottom