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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Into error ...

Status
Not open for further replies.

tinymind

Programmer
Nov 9, 2000
90
GB
I have a simple Insert statement that does not want to run ..

Dim dbs As Database
Dim staff As String

Set dbs = CurrentDb()
Set order = Forms![frmOrder]![OrderNo]
dbs.Execute ("Insert into tmporderList (OrderNo) value (Order);")

I am new to VB and SQL and can't understand what it is that I am doing wrong ...??

Tiny
 
You need.......

if Order is a NUMBER

dbs.Execute ("Insert into tmporderList (OrderNo) value (" & Order & ");")

if Order is a STRING

dbs.Execute ("Insert into tmporderList (OrderNo) value ('" & Order & "');")
 
Thanks...

thats is exactly what I wanted to do ...

Tiny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top