tags:

views:

38

answers:

2

Hello

On a continouos form in ms-access, I have a record source similar to

select
  col_1,
  col_2 & " " & col_3 as col_expr
from
  tblFoo

and then I have bound col_expr to a text box on that form.

When I open the form, it displays the value of col_2 & " " & col_3 correctly in the textbox. Obviously, editing the value within the text box doesn't work because its value is derived from an expression rather than from a field in the table. Accordingly, access prohibits me from doing so: when I click into the field, I cannot alter anything in the field.

I understand that behaviour. Yet, I am looking for a method to override that behaviour. That is, I want to be able to enter a value into that field and (for example) in its BeforeUpdate event retrieve the entered value and do a custom-insert/update and then set cancel to true.

Is this possible?

A: 

It may suit to use a work around, for example, display a hidden textbox for the update and dynamically rewrite the sql using the new data.

EDIT re Comment Alternatively you could show a small form for editing any record in the continuous form.

Remou
Now, a hidden textbox doesn't help me, since the user cannot enter something into a hidden textbox. Setting the hidden textbox temporarly to visible isn't better because it would be visible in each record on the continuous form.
René Nyffenegger
"display a hidden textbox" surely suggests making it visible for the user? The point was to suggest using work-around, not to provide a number of work-arounds as such a solution may not suit at all. I have added another suggestion.
Remou
A: 

You could fire off an update query on the “After Update” event of that text box. After validating the data of course.

Kevin Ross
The thing is: I can't change the value in the textbox as the textbox prohibits me from changing it.
René Nyffenegger