By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,956 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,956 IT Pros & Developers. It's quick & easy.

Add data to tables programmatically

P: 1
I have been trying to create and add a record to a table not referenced on a form based off of information on the form for WEEKS! Other forums have been no help and I find my answer by reading some posts on your forum. I like the clear concise way you help us newbies to understand stuff
May 9 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 14,534
If you mean you wish to add data to a table that is on the form but the table is not bound to the form then you need to insert the data programmatically.

Assuming ColumnA is a date, ColumnB a String and ColumnC a number then something like ...
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  3.    strSQL = "INSERT INTO TableName (ColumnA, ColumnB, ColumnC) " & _
  4.       "VALUES (#" & Me!txtDate & "#, '" & Me!txtString & "', " & Me!txtNum & ")"
  5.    DoCmd.RunSQL strSQL
May 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.