Add record programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, everybody

I tried to write a code for adding a new record to my table. A simple [tablefield]=[value] assignment did not work
Can someone say, what was my mistake and what is the best way of adding records using VBA

Thanks in advance
Eugene.
 
Eugene said:
Hello, everybody!

I tried to write a code for adding a new record to my table. A simple
[tablefield]=[value] assignment did not work.
Can someone say, what was my mistake and what is the best way of adding records using VBA?

Thanks in advance,
Eugene.

CurrentDB.Execute "INSERT INTO TableName (Field1, Field2, ...) VALUES (Value1,
Value2, ...)",dbFailOnError

In the VALUES list non numeric entries would need to be properly delimited (')
for text, (#) for dates. The list could also use form references to pull the
values from controls on open forms or the VALUES list can be entirely replaced
with a SELECT statement to grab rows from another table.
 
-----Original Message-----
Hello, everybody!

I tried to write a code for adding a new record to my
table. A simple
[tablefield]=[value] assignment did not work.
Can someone say, what was my mistake and what is the
best way of adding
records using VBA?
Thanks in advance,
Eugene.

CurrentDB.Execute "INSERT INTO TableName (Field1, Field2, ...) VALUES (Value1,
Value2, ...)",dbFailOnError

In the VALUES list non numeric entries would need to be properly delimited (')
for text, (#) for dates. The list could also use form references to pull the
values from controls on open forms or the VALUES list can be entirely replaced
with a SELECT statement to grab rows from another table.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


.
 
Back
Top