SQL Text Delimited

  • Thread starter auujxa2 via AccessMonster.com
  • Start date
A

auujxa2 via AccessMonster.com

I have a function that works great, it makes active stores not active.
Here's the code.

For Each varItem In Me.lstActiveStores.ItemsSelected

strSQL = "UPDATE [MasterTbl] " & "SET [Indicator] = FALSE " & _
"WHERE [MasterTbl].[Vendor] = """ & Me.lstVendors.Column(0) & """" &
_
" And [MasterTbl].[Department] = """ & Me.cboDepartments & """" & _
" And [MasterTbl].[Stores] = """ & ctl.ItemData(varItem) & """"

DoCmd.RunSQL strSQL

Next varItem

I need to do the opposite. Make NonActive stores active. So I need to do an
append query, and fill the masterTbl with the 3 fields from the lst and cbo
boxes. I'm VERY new to SQL, so I don't know how to make my statement below
text delimited like the one above.

For Each varItem In Me.lstNonActiveStores.ItemsSelected

strSQL = "INSERT INTO MasterTbl(Vendor, Department, Stores)" & _
"SELECT me.lstVendors, me.cboDepartments, ctl.ItemData(varItem);"

DoCmd.RunSQL strSQL

Next varItem
 
B

bcap

strSQL = "INSERT INTO MasterTbl(Vendor, Department, Stores) " & _
"VALUES (""" & Me.lstVendors & """,""" & me.cboDepartments & """,""" &
ctl.ItemData(varItem) & """)"
CurrentDb.Execute strSQL, dbFailOnError
 
A

auujxa2 via AccessMonster.com

Perfect!

Cheers
strSQL = "INSERT INTO MasterTbl(Vendor, Department, Stores) " & _
"VALUES (""" & Me.lstVendors & """,""" & me.cboDepartments & """,""" &
ctl.ItemData(varItem) & """)"
CurrentDb.Execute strSQL, dbFailOnError
I have a function that works great, it makes active stores not active.
Here's the code.
[quoted text clipped - 29 lines]
Next varItem
 
Top