Logging Problem

J

John Daily

I am having a problem with a form that displays the
current users name on it in a text box. There is another
text box with the current date and time.
I have these linked to a table but can't figure out how to
pass the information to the table once the user clicks on
the agree button or when they open the database (either
one is fine). I need it to track usage and I can't get it
to work. I think it is probably something simple I am
overlooking.

Please help!

TIA,

John
 
M

Matt Weyland

when the form closes:

docomd.runsql("INSERT INTO tablename VALUES( "" &
nametextbox & "", "" & datetextbox & "")")

I think I got the ""s right. I usually create a function
to make reading it easier

public function AddQuotes(strString as string) as string
Addquotes= vbchr(34) & strstring & vbchr(34)
end function

If you use that:
docmd.runsql("INSERT INTO tablename VALUES(" & addquotes
(nametextbox) & ", " & addquotes(datetextbox) ")")

HTH

mw
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top