Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Table Insertion question

Status
Not open for further replies.

Netooi

Programmer
May 15, 2002
29
US
I have a string called "MyStr" that has a name in it.
I want to be able to insert that name into a table in my Access database called tblData that has a field called Name.
Could someone hook me up with the VB to do this?
Thanks,
Netooi
 
nee,
Is this a variable, ie dim Mystr as string? Then you give it a value? If so, do
docmd.runsql "Insert into TheTable (NameField) Values(""" & Mystr & """)"

This assumes this is a New Record....if it exists, and you're Updating, then you need ot know the Key, and you'd do

docmd.runsql "Update TheTable set NameField = """ & mystr & """ WHERE Key = " & variableKey

--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top