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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

List Box 11
Multi List Values 1
rst loop versus For Each 4
SQL Question 3
SQL Syntax Error 1
Select Case - SQL 2
Update Query Using Multi List Box 1
Query Inside an SQL statement 3

Top