Edit text value in two tables

G

Guest

Hi,

i have a form which by the not in list value allows the user to add new entries in a table (via insert into sql) and opens a form to allow the user to edit other informations based ond the source tabel. My problem is what to do when the user wants to edit this value (if the original value was wrong). I wish to do this by inserting a buttom (edit buttom) that asks the user if he (or she) wants to edit the value in focus, if yes then ask which new value that should replace the orginal one in the two tables. Hope somone has a good idea! All values includes is text.

Eri
 
A

Allen Browne

If you have a relationship with cascading updates, editing the value in the
primary table will cause all the related records to update as well.

1. Open the Relationships window (Tools menu).

2. Add the tables and create the relationship, or double-click the line
joining the 2 tables to edit the relation.

3. Make sure the Referential Integrity box is checked, and check the box for
Cascading Updates.

Now the user can edit the value in the main table. In order for the
cascading update to take case, the related record cannot be dirty, so on
your form your "edit" button would need to do something like this:

Private Sub cmdEdit_Click()
If Me.Dirty Then 'Save first.
Me.Dirty = False
End If
DoCmd.OpenForm "xxxx", WindowMode:=acDialog
Me.MyCombo.Requery
End Sub


Note: Replace "xxxx" with the name of the form where the user enters/edits
the items in the combo's table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Erik said:
i have a form which by the not in list value allows the user to add new
entries in a table (via insert into sql) and opens a form to allow the user
to edit other informations based ond the source tabel. My problem is what to
do when the user wants to edit this value (if the original value was wrong).
I wish to do this by inserting a buttom (edit buttom) that asks the user if
he (or she) wants to edit the value in focus, if yes then ask which new
value that should replace the orginal one in the two tables. Hope somone has
a good idea! All values includes is text.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top