Solved

SQL insert into statement question (access 2007)

Posted on 2008-06-13
4
665 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
ID: 21778531
Dim ts As String
ts = "Your Note"
DoCmd.RunSQL "INSERT INTO NotesTable([Notes])VALUES ('" & ts & "')"
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 21778587
just a slight correction

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

Author Comment

by:TSTechNA
ID: 21778618
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
ID: 21778666
DoCmd.RunSQL "INSERT INTO NotesTable([Notes]) VALUES ('" & ts & " " & now() & "')"
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about achieving the basic levels of HRIS security in the workplace.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

929 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

20 Experts available now in Live!

Get 1:1 Help Now