What is this ?

GlennG

Board Regular
Joined
May 20, 2002
Messages
80
Hello all,

I am slowly trying to learn Access and I found this bit of code which I find completely unbelievable. Do I have to learn how to write this stuff ? Is there a tool to help me reproduce this or create this ? I'm used to VBA Excell and that makes sense to me but this !!!! What is it ??? :cry:

chaine = "SELECT LOCAL, IIf(PRODUITS='3000' OR PRODUITS='7100','VOR.N','VNOIR.N') AS PRODUIT, Sum(MARGE) AS DATA INTO MOIS_VISA " & _
"FROM INP_VISA INNER JOIN CONV_LOCAL ON INP_VISA.LOCAL_INP = CONV_LOCAL.LOCAL_INP " & _
"GROUP BY CONV_LOCAL.LOCAL, IIf(PRODUITS='3000' OR PRODUITS='7100','VOR.N','VNOIR.N'), PRODUITS " & _
"HAVING Sum(MARGE) <> 0 And PRODUITS In ('0100','2000','3000','5000','7000','7100') " & _
"ORDER BY CONV_LOCAL.LOCAL, IIf(PRODUITS='3000' OR PRODUITS='7100','VOR.N','VNOIR.N')"
dbs.Execute chaine
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
It's SQL code, contained in a variable. Probably the best tool for writing SQL is the query builder in Access. Create a new query, add a couple of tables and drag some fields into the lower part of the window. Now go to the VIEW menu and choose SQL view. There you will find the code you just 'wrote'. You can create joins, add criteria, create calculated fields, all graphically in the query builder. You can use this as the basis for your variable in VBA, with a little tweaking.
 
Upvote 0
Wow !!!

Big Big Thank you for your help..... I now have hope ! I might actually get thru this alive !

Glenn
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top