I have a bit of code that I am working with that works with the items selected in a listbox. From there, I would like to add new part#s based on the items selected. This way I can assign 1 part# to several Task#s (if several are selected) at one time....
I am having "syntax" problems with the append query I'm tryin' to run... Not sure if I need to use "SELECT" or "VALUES" or both..??? I'm tryin' to INSERT from a table, a few Global Variables, and a few textboxes on my form...Below is what I am working with:
DoCmd.RunSQL "INSERT INTO PartMaster ( TaskNo, FleetID, DocNo, MPN, IID, Qty, Unit, TotReqd) " & _
"SELECT TaskMaster.TaskNo, " & GBLFleetID & "," & GBLDocNo & "," & Me.MPNLookup & "," & Me.IIDLookup & "," & Me.txtQty & "," & Me.txtUnit & "," & Me.txtTotalReqd & " " & _
"FROM TaskMaster " & _
"WHERE (((IsSelectedVar('Documents','TaskNoList',[TaskNo]))=-1));"
TaskNo - number data type
FleetID - text data type
DocNo - text data type
MPN - text data type
IID - text data type
Qty - number data type
Unit - text data type
TotReqd - text data type
Any fixes, suggestions, examples...??
Thanks in advance..!!
jcw5107
I am having "syntax" problems with the append query I'm tryin' to run... Not sure if I need to use "SELECT" or "VALUES" or both..??? I'm tryin' to INSERT from a table, a few Global Variables, and a few textboxes on my form...Below is what I am working with:
DoCmd.RunSQL "INSERT INTO PartMaster ( TaskNo, FleetID, DocNo, MPN, IID, Qty, Unit, TotReqd) " & _
"SELECT TaskMaster.TaskNo, " & GBLFleetID & "," & GBLDocNo & "," & Me.MPNLookup & "," & Me.IIDLookup & "," & Me.txtQty & "," & Me.txtUnit & "," & Me.txtTotalReqd & " " & _
"FROM TaskMaster " & _
"WHERE (((IsSelectedVar('Documents','TaskNoList',[TaskNo]))=-1));"
TaskNo - number data type
FleetID - text data type
DocNo - text data type
MPN - text data type
IID - text data type
Qty - number data type
Unit - text data type
TotReqd - text data type
Any fixes, suggestions, examples...??
Thanks in advance..!!
jcw5107