Solved

SQL insert into statement question (access 2007)

Posted on 2008-06-13
4
664 Views
Last Modified: 2013-11-27
is there a way to include my variable ts with whatever the user types in the parameter box?
thank you

Dim ts As String
ts = Now
DoCmd.RunSQL "INSERT INTO NotesTable([Notes])VALUES ([Enter your note])"
0
Comment
Question by:TSTechNA
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
orcic earned 500 total points
Comment Utility
Dim ts As String
ts = "Your Note"
DoCmd.RunSQL "INSERT INTO NotesTable([Notes])VALUES ('" & ts & "')"
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
just a slight correction

----------------------------------------------------------------v-put a space
DoCmd.RunSQL "INSERT INTO NotesTable([Notes]) VALUES ('" & ts & "')"
0
 

Author Comment

by:TSTechNA
Comment Utility
awesome, that works but could you explain why it works? i don't really understand the syntax

also is there a way to include ts and my parameter of ([Enter your note]) together? so that they will be 1 record? basically a time/date stamped comment/note is all i am trying to do

thank you
0
 
LVL 7

Expert Comment

by:orcic
Comment Utility
DoCmd.RunSQL "INSERT INTO NotesTable([Notes]) VALUES ('" & ts & " " & now() & "')"
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now