Using Vb in access to alter records




I am using access, what I want to do is put data into a new record. I know
how to select a new record, but I do not know how to manipulate it once that
record is selected .

once I do this:
DoCmd.GoToRecord acDataTable, "tablename", acNewRec

how do I put data into the new record and how do I select which column in
the row I want to alter?

Allen Browne

Execute an Append query statement, e.g.:
strSql = "INSERT INTO ...
dbEngine(0)(0).Execute strSql, dbFailOnError

To get the SQL statement:
1. Create a new query. No table.

2. Type the value you want to add into a fresh column in the Field row,

3. Change it to an Append Query (Append on Query menu)
Access will ask what table to append to.

4. Switch to SQL View (View menu.)
There's an example of the string you need to execute.


Dude don't listen to these guys

if you MUST use this strSql method; then do
CurrentProject.Connection.Execute- that won't give you a memory leak
for starters

DAO is one huge memory leak; and it's impossible to use reliably.

needing to close down objects should not be necessary; DAO is just a
bullshit library

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