galvanize
galvanize

Reputation: 547

Editing data from database in textbox which are taken from subform

In my form I have a subform, which displays A, B, C. Then information C is displayed in textbox. User should have a possibility to modify this data in order to modify data in database.

I am able to display information C in text box based on this subform. However it is uneditable, it is written: "Control can't be edited; it's bound to the expression".

It seems to me, that it is impossible to edit data because it is taken not directly from database but from sub form, so I make special query which takes data directly from database however I lose an event which is based on selecting proper record from subform (there is only onEnter and onExit events)

Is it possible to make such things?

Upvotes: 1

Views: 1690

Answers (3)

galvanize
galvanize

Reputation: 547

Ok, There is a solutions to my problem: http://bytes.com/topic/access/answers/950422-editing-data-database-textbox-taken-subform

Thank You for any suggestions!

Upvotes: 0

HansUp
HansUp

Reputation: 97101

You can add a second subform to contain the C text box. Link the second subform to the first with the underlying table's primary key.

That's the easiest alternative I can think of to make the text box editable.

Upvotes: 1

Grant
Grant

Reputation: 903

If you're using a recordset to populate or modify anything, then make sure you are using the .Edit and .Update to modify an existing cell in a row.

Dim myR as Recordset

Set myR = CurrentDb.OpenRecordset("Table_Name_Here", dbOpenDynaset)

'use a .FindFirst method to find the row you want to modify
'or modify the Recordset to pull a SELECT statement instead of the whole table

myR.Edit
myR![Field_to_edit] = Forms![main form name]![subform control name].Form![control name]
myR.Update

Set myR = Nothing

Upvotes: 0

Related Questions