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!

Specifying numbers, text, dates 2

Status
Not open for further replies.

BrianLe

Programmer
Feb 19, 2002
229
US
In AC97, I'm trying to add records to a table with information from cbxTask - number, lbxOperator - number, tbxCompletionDate - Date, and chkSupvJobBriefing -y/n that are on frmTaskCompletion using an "On Click" event like the following. I'm sure it isn't close, but I'm lost as far as how to specify text, dates, numbers, etc.

SQL = "INSERT INTO tblTaskLog (TaskID, OperatorID, CompletionDate, SupvJobBriefing) " & _
"VALUES (" & DQ & cbx.Column(0) & DQ & ", " &_
& DQ & lbx.Column(0,itm) & DQ & ", " &_
& DQ & tbx & DQ & ", " &_
& DQ & chk & DQ & ");"

I get various error when I try different versions.

Any suggestions?

Thanks,

Brian
 
SQL = "INSERT INTO tblTaskLog (TaskID, OperatorID, CompletionDate, SupvJobBriefing) " & _
"VALUES (" & cbx.Column(0) & ", " &_
& lbx.Column(0,itm) & ", " &_
& "#" & tbx & "#" & ", " &_
& chk & ");"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I'm not sure if the extra &s will have a negative outcome but you do need to have a space between the & and _.

[cod]
SQL = "INSERT INTO tblTaskLog (TaskID, OperatorID, CompletionDate, SupvJobBriefing) " & _
"VALUES (" & cbx.Column(0) & ", " & _
lbx.Column(0,itm) & ", " & _
"#" & tbx & "#" & ", " & _
chk & ");"
[/code]

Duane
Hook'D on Access
MS Access MVP
 
PHV - you got me on the right track. I ended up with essentially what Duane recommended. The extra &'s did cause a problem until I got rid of them.

Code:
SQL = "INSERT INTO tblTaskLog (TaskID, OperatorID, CompletionDate, SupvJobBriefing) " _
"VALUES (" & cbx.Column(0) & ", " _
           & lbx.Column(0,itm) & ", " _
           & "#" & tbx & "#" & ", " _
           & chk & ");"

Thanks to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top