Probleme Requete Access Insert sur 68 Champs

Résolu
cs_bluntz54 Messages postés 14 Date d'inscription mercredi 5 mars 2008 Statut Membre Dernière intervention 15 avril 2008 - 13 mars 2008 à 15:30
cs_chapata Messages postés 214 Date d'inscription mercredi 2 février 2005 Statut Membre Dernière intervention 9 avril 2010 - 13 mars 2008 à 16:25
Bonjour voilà j'ai une requête INSERT sous Access avec 68 champs. Certains noms de champ comportent plusieurs mots et d'autres se nomment # RFTs. Mon problème est de réussir à écrire correctement cette requête.
Je vous fournis le début en esperant sincèrement que quelqu'un pourra m'aider.

                                                                 Cordialement

sql = "INSERT INTO table1 (Facturation K&N du,Année,Type de facture,Order Release Nr,OR_DELIVERY_NOTE_NUMBER,Center Code,SAP_ACCOUNT,SAP_PROFIT_CENTER,SAP_COST_CENTER,# RFTs,Original Location code,VAT Type,ReturnYes / No,Invoice Receiver,Raflatac Order Type,OR_Source_Location Name,OR Source City,OR Source Country Code,OR Source Postal Code,Pickup Seq Nr,Planned Pickup date,Planned Pickup time,"
Actual Pickup date,Actual Pickup time,OR_DESTINATION_CUSTOMER_CODE,Final Destination Name,Final Dest City,OR Final Destination Country,
OR Destination Postal Code,Drop Seq Nr,Planned Delivery date,Planned Delivery time,EAN Code,Shipped Unit,Unit,Weight,Rounded Weight,Total Net Weight,Total m3,
Total m2,Rounded m2,Carrier,Shipment Group Nr,Shipment Nr,Source Code for the cost,Source Name for the cost,Source City for the cost,
Destination Code for the cost,Destination Name for the cost,Destination City,Destination Post code,Shipment Destination Country,Trpt Mode,Equipment,GC3 Invoice Nr,GC3 Voucher Nr,
Voucher creation date,Voucher creation time,Rate calculation zones,Type of Cost,Accessorial Code,Accessorial Description,Adjustment Reason Code,
Adjustment Reason Description,Cost Amount,VAT Rate,VAT Amount , iTotal Amount ,Currency,MAIN CLIENT,ORDER_TYPE)


VALUES ('"&iOrder_Release_Nr&"','"&iOR_DELIVERY_NOTE_NUMBER&"',"'iCenter_Code'", "'iSAP_ACCOUNT'","'iSAP_PROFIT_CENTER'",
"'iSAP_COST_CENTER'","'i_RFTs'", "'iOriginal_Location_code'", "'iVAT_Type'",
iReturn_Yes_No, iInvoice_Receiver, iRaflatac_Order_Type,
iOR_Source_Location_Name, iOR_Source_City, iOR_Source_Country_Code,
iOR_Source_Postal_Code , iPickup_Seq_Nr , iPlanned_Pickup_date, iPlanned_Pickup_time,
 iActual_Pickup_date, iActual_Pickup_time, iOR_DESTINATION_CUSTOMER_CODE,
iFinal_Destination_Name, iFinal_Dest_City, iOR_Final_Destination_Country,
iOR_Destination_Postal_Code, iDrop_Seq_Nr, iPlanned_Delivery_date, iPlanned_Delivery_time,
iEAN_Code, i_Shipped_Unit, i_Unit, iWeight, iRounded_Weight, iTotal_Net_Weight, iTotal_m3,
iTotal_m2, iRounded_m2, iCarrier, iShipment_Group_Nr, iShipment_Nr,
iSource_Code_for_the_cost, iSource_Name_for_the_cost, iSource_City_for_the_cost,
iDestination_Code_for_the_cost, iDestination_Name_for_the_cost, iDestination_City,iDestination_Post_code,
iShipment_Destination_Country, iTrpt_Mode, iEquipment, iGC3_Invoice_Nr, iGC3_Voucher_Nr,
iVoucher_creation_date, iVoucher_creation_time, iRate_calculation_zones , iType_of_Cost ,
iAccessorial_Code , iAccessorial_Description, iAdjustment_Reason_Code,
iAdjustment_Reason_Description, iCost_Amount, iVAT_Rate , iVAT_Amount , iTotal_Amount ,
iCurrency , iMAIN_CLIENT , iORDER_TYPE);"

3 réponses

cs_chapata Messages postés 214 Date d'inscription mercredi 2 février 2005 Statut Membre Dernière intervention 9 avril 2010 5
13 mars 2008 à 15:57
Hello ,

pour tes champs, il est obligatoire de écrires comme suit :

sql = "INSERT INTO table1 ([Facturation K&N du],[Année],[Type de facture],[Order] etc ....

car tu as des mots composés ....

A ++++ 

***********  Si cette réponse vous convient, merci de valider ce post  ***********

ChaPaTa
/FONT>
3
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
13 mars 2008 à 16:23
on peux aussi utiliser des `   (AltGr + 7 sur un clavier AZERTY classique) pour séparer les noms de tables & champs

Renfield
Admin CodeS-SourceS- MVP Visual Basic
3
cs_chapata Messages postés 214 Date d'inscription mercredi 2 février 2005 Statut Membre Dernière intervention 9 avril 2010 5
13 mars 2008 à 16:25
Hello ,

oui Renfield à raison aussi ... cette méthode est aussi valable.

***********  Si cette réponse vous convient, merci de valider ce post  ***********
ChaPaTa
3
Rejoignez-nous