Function to write to table

jasmin_m

New member
Local time
Today, 17:17
Joined
Jan 10, 2010
Messages
8
Is there a function to write to practicular field in table.

For example wit DLookup function we read particular field
from table, is there similar function for writing to field in table.
 
DoCmd.runsql
Db.execute

The sql needs to be either "insert into" or "update"

If your feeling not not sleeping you can mod records in a recordset.....
 
Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("table")
' if you need to add new record

rs.Edit
rs!Value= "new"

rs.Update
rs.Close

.......

situation;
I have a tabe called "tabel"
and two fields in it:
"ID" and "Value"

And I want with above code to update
field "value" for ID =3

....
Why I am geting error on this
rs.FindFirst "ID = 3 "
rs.Edit
rs!Value= "3333333333"
rs.Update
rs.Close
 
Last edited:
rs.Index = "ID"
rs.Seek "=", 3

In general, for equivalent types of searches, the Seek method provides better performance than the Find methods. This assumes that table-type Recordset objects alone can satisfy your needs.

Why use a recordset?
 
note that seek is not directly available with a linked ytable - eg a normal access backend
 
note that seek is not directly available with a linked ytable - eg a normal access backend
Interesting!Help file says nothing about that ,,,, or my reading is somewhat lacking
Can you correct the FindFirst?
 
Interesting!Help file says nothing about that ,,,, or my reading is somewhat lacking
Can you correct the FindFirst?

yea,
can someone write this example with findfirst
I am searching for a while....

and I also have problem with this also
rs.Index = "ID"
rs.Seek "=", 4

If rs.NoMatch Then
MsgBox "No matches found.", vbInformation, "No records."
Else

' error need EDIT how
rs!Naziv = "asass"
MsgBox rs!Naziv
End If
rs.Close
 
Last edited:
This part of your code was fine:
rs.Edit
rs!Value= "new"

rs.Update
rs.Close
 
To locate a record in a table-type Recordset, use the Seek method

Had to read the help file again it seems:

If you change "table" to
"Select * from table" it should work

I keep meaning to say: "Value" is a reserved word - don't use it as a column name
 
Last edited:

Users who are viewing this thread

Back
Top Bottom