inserting values from textboxes...

  • Thread starter Thread starter infael
  • Start date Start date
I

infael

I'm working on a form where a user can put a value in text
boxes to be saved to a database. I've been unable to find
the right code to insert said values. How can I do this?

Your help is greatly appreciated.


TIA
infael
 
Hi,
Usually you would just have a form that is bound to a table or query and
Access will do the work for you.
If you want to do it yourself:

Dim strSql As String

strSql = "Insert Into yourTable (field1,field2) Values('" & Me.yourtextBox1
& "','" & Me.yourTextBox2 & "')"
CurrentDb.Execute strSql, dbFailOnError

I have assumes that the values were strings so I have delminted them with
single quotes in the SQL string.
If they are numeric, you don't need a delimter and if they are dates you
need to delimit with #

HTH
Dan Artuso, MVP
 
Dan,

Binding the form and table is much easier. However, I was
unable to do so. I did find an example database that had
no event procdures so I'm guessing the form was bound to
the table. I haven't yet figured it out.

Any help you could give me would be much appreciated!

Infael
 
bump
-----Original Message-----
Dan,

Binding the form and table is much easier. However, I was
unable to do so. I did find an example database that had
no event procdures so I'm guessing the form was bound to
the table. I haven't yet figured it out.

Any help you could give me would be much appreciated!

Infael ('"
& Me.yourtextBox1
.
 
Back
Top