|
 |
access thread: insert or update
Message #1 by "jolanta mazur" <jolanta_mazur@h...> on Sat, 22 Sep 2001 09:38:41
|
|
Thanks.
I want to write a VBA code, which helps me to update a table from a form's
boxes. e.g. I have a box, which has a value =Left([LastName],3) &
Right([WorkPhone],4). How can I update/insert this value into ID field into a table with ID column?
With regards
Yola
Message #2 by "Carol Mandra" <carol_mandra@r...> on Mon, 24 Sep 2001 18:35:49
|
|
Yola, This code can be done with SQL or with VB. Put the code in the
form's afterUpdate event.
Form name: frmData
Box on the form: txtID
Table: MyTable
VB code:
Dim db as database, rs as recordset
Set db =currentdb()
Set rs = Db.openrecordset("MyTable")
Mytable!ID = me.txtID
(save other text boxes to the table here)
Rs.update
Rs.close
Set db=nothing
SQL code-------------------------------------------------------
Dim db as database
Set db=currentdb()
Db.execute "UPDATE mytable SET ID ='" & me.txtID & "';"
Set db=nothing
Hope this helps. Carol ;-)
------------------------------------------------------------------
>I want to write a VBA code, which helps me to update a table from a
form's boxes. e.g. I have a box, which has a value =Left([LastName],3) &
Right([WorkPhone],4). How can I update/insert this value into ID field
into a table with ID column? > With regards Yola
|
|
 |