Adding new records command button

paranap

New member
Local time
Today, 15:11
Joined
Jul 28, 2012
Messages
9
New to using VBA in access and wish to add data from text boxes or drop down boxes to a table. I'm sure it is simple but cant for the life of me seem to work it out!!
 
One way of doing it would be using SQL:

Code:
Currentdb.Execute "INSERT INTO YourTableName VALUES ('" & me.myTextBox & "')"

The above assumes your table name is YourTableName and your Textbox name is MyTextBox.

Here's more info on INSERT INTO: http://www.w3schools.com/sql/sql_insert.asp
 
Thank you Sam will try that shortly and will let you know how I get on!!
 
Thank you that worked really well. I knew there must be an easy way of doing it. Found the link useful too!!
 
The code given you use me.text where text is the name of the text box. What does the the "me" denote?? Want to add an attatchemnt do a table now and the same process doesnt work!
 
Me. is a reference to the active form. So Me.ControlName is a reference to a control of the form.
 
Can you use the VALUES function to add an attachment to a table??
 

Users who are viewing this thread

Back
Top Bottom