Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT text box value to table

Status
Not open for further replies.

BrianLe

Programmer
Feb 19, 2002
229
US
In Access 97, I'm trying to use an SQL statement to insert the "value" of tbx1 to tblSchedule. In one case the "value" is a Date and the other it is Text. I believe my problem is what to put after the "." in tbx1." ". The Insert statement is also used to insert other combo box and list box values. That part works OK.

Code:
SQL = "INSERT INTO tblSchedule (DateTime) " & _
                 "VALUES (" & DQ & tbx1."????" & DQ & ");"

Thanks, Brian
 
You may try this:
SQL = "INSERT INTO tblSchedule (DateTime) " & _
"VALUES (#" & tbx1.Value & "#)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I get a syntax error in INSERT INTO statement.
 
DateTime is a reserved word:
SQL = "INSERT INTO tblSchedule ([DateTime]) " & _
"VALUES (#" & tbx1.Value & "#)"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
What you suggested works if I use it all by itself, but when I try to add it to my list of other commands I can't get it to work.

Code:
DQ & cbx2.Column(0) & DQ & "," & _
(#" & tbx1.Value & "#)"

Thanks, Brian
 
Any chance you could post the WHOLE SQL you want to build, explaining clearly which fields are numeric, text or date ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top