update bound textbox ?

qwertyjjj

Registered User.
Local time
Today, 00:36
Joined
Aug 8, 2006
Messages
262
I need to have 2 textboxe son my form that are directly linked to data in a DB so that the user can type values in directly.
Unfortunately, the data for these 2 textboxes is completely separate from the main form's recordsource.

Is it possible to do this using an expression? I've tried but it only retrieves the data rather than allows you to update it.
If not, then will I have to do this through VBA code?
 
You could write a query that contains the table that you are currently using as the forms record source and the fields you want displayed in the 2 textboxes. Then you can change the forms record source to be the query that you have just written.
 
If the two textboxes are not bound to the record source of your form, then you have to use VBA code to enter/edit a record in your target table.

You can use a DoCmd.RunSql statement to either edit a record or add a record to your target table by supplying all the necessary parameters e.g. field names and the source of the values you want in the selected fields.

In your particular situation, the source of the value would be your two text boxes. If there are some "required" fields in the table, you'll have to supply those too if you are adding to it. If you are editing, you only need to mention the fields you are editing.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom