🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.bazy-danych.msaccess
Article #137346

Re: export kwerendy do pliku csv

#137346
From: Jan Koc
Date: Thu, 01 Dec 2016 19:28
143 lines
7353 bytes
Nie wiem czy to będzie ciekawostka ale zapraszam Pana Bratko oraz towarzyszącego mi w zmaganiach Pana MaciejaF do próby znalezienia (pewnie mojego) błędu
Poniżej jest kod tworzący niezbędną tabelę i wpisujący jakieś tam dane.
Proszę po uruchomieniu z przycisku dodać specyfikację exportu do dowolnego z nazwy pliku csv, z zastrzeżeniem, że separatorami ma być średnik i należy transportować nagłówki kolumn. Po dokonaniu exportu proszę wejdźcie na stronę
https://www.sendit.pl/logowanie

utworzyłem tam konto 

login:janmroz@onet.eu
hasło"123456

zalogujcie się, a potem :
-NADAJ PACZKĘ
-IMPORTUJ DANE Z CSV
-WYBIERZ
tu wybieramy nasz utworzony plik CSV
-WYŚLIJ

Jeśli plik i dane są poprawne to otrzymujemy skrótową informację o adresie odbiorcy
w przeciwnym razie na czerwono wyświetla się komunikat o błędach.
Jeśli nie macie błędów to ja coś mieszam, bo ja tu mam błąd.

Bez zamykania aplikacji SENDIT otwórzcie Wasz plik csv i zróbcie to o czym pisałem : "zapisz jako ... csv" . Po zamknięciu powróćcie do aplikacji i jeszcze raz wybierzcie teraz już zmieniony plik csv, a potem WYŚLIJ.

Jeśli uzyskacie poprawny wynik to należałoby na tym zakończyć i nie robić następnych kroków, aby w firmie SENDIT nie zrobić zbędnych bałaganów, gdyż konto jet fikcyjne.

I o to chodzi.

Jan
----------------------
'
 Dim db As DAO.Database
 Dim tdf As DAO.TableDef
 Dim fldAddr1 As DAO.Field, fldAddr2 As DAO.Field, fldAddr3 As DAO.Field
 Dim fldAddr4 As DAO.Field, fldAddr5 As DAO.Field, fldAddr6 As DAO.Field
 Dim fldAddr7 As DAO.Field, fldAddr8 As DAO.Field, fldAddr9 As DAO.Field
 Dim fldAddr10 As DAO.Field, fldAddr11 As DAO.Field, fldAddr12 As DAO.Field
 Dim fldAddr13 As DAO.Field, fldAddr14 As DAO.Field, fldAddr15 As DAO.Field
 Dim fldAddr16 As DAO.Field, fldAddr17 As DAO.Field, fldAddr18 As DAO.Field
 Dim fldAddr19 As DAO.Field, fldAddr20 As DAO.Field, fldAddr21 As DAO.Field
 Dim fldAddr22 As DAO.Field, fldAddr23 As DAO.Field, fldAddr24 As DAO.Field
 Dim fldAddr25 As DAO.Field, fldAddr26 As DAO.Field
 Set db = CurrentDb
 On Error Resume Next

 Set tdf = db.CreateTableDef("Export_DPD")

 Set fldAddr1 = tdf.CreateField("S_Name", dbText)
 Set fldAddr2 = tdf.CreateField("S_Address", dbText)
 Set fldAddr3 = tdf.CreateField("S_Zip", dbText)
 Set fldAddr4 = tdf.CreateField("S_City", dbText)
 Set fldAddr5 = tdf.CreateField("S_Phone", dbText)
 Set fldAddr6 = tdf.CreateField("S_Email", dbText)
 Set fldAddr7 = tdf.CreateField("S_Contact_Person", dbText)
 Set fldAddr8 = tdf.CreateField("P_Cat_KP", dbLong)
 Set fldAddr9 = tdf.CreateField("P_Cat_5", dbLong)
 Set fldAddr10 = tdf.CreateField("P_Cat_10", dbLong)
 Set fldAddr11 = tdf.CreateField("P_Cat_20", dbLong)
 Set fldAddr12 = tdf.CreateField("P_Cat_30", dbLong)
 Set fldAddr13 = tdf.CreateField("P_Cat_50", dbLong)
 Set fldAddr14 = tdf.CreateField("R_Name", dbText)
 Set fldAddr15 = tdf.CreateField("R_Address", dbText)
 Set fldAddr16 = tdf.CreateField("R_Zip", dbText)
 Set fldAddr17 = tdf.CreateField("R_City", dbText)
 Set fldAddr18 = tdf.CreateField("R_Phone", dbText)
 Set fldAddr19 = tdf.CreateField("R_Email", dbText)
 Set fldAddr20 = tdf.CreateField("R_Contact_Person", dbText)
 Set fldAddr21 = tdf.CreateField("P_Courier_Name", dbText)
 Set fldAddr22 = tdf.CreateField("P_Comment", dbText)
 Set fldAddr23 = tdf.CreateField("P_Content", dbText)
 Set fldAddr24 = tdf.CreateField("A_Terminal", dbText)
 Set fldAddr25 = tdf.CreateField("P_Cod", dbLong)
 Set fldAddr26 = tdf.CreateField("Time", dbText)


 tdf.Fields.Append fldAddr1
 tdf.Fields.Append fldAddr2
 tdf.Fields.Append fldAddr3
 tdf.Fields.Append fldAddr4
 tdf.Fields.Append fldAddr5
 tdf.Fields.Append fldAddr6
 tdf.Fields.Append fldAddr7
 tdf.Fields.Append fldAddr8
 tdf.Fields.Append fldAddr9
 tdf.Fields.Append fldAddr10
 tdf.Fields.Append fldAddr11
 tdf.Fields.Append fldAddr12
 tdf.Fields.Append fldAddr13
 tdf.Fields.Append fldAddr14
 tdf.Fields.Append fldAddr15
 tdf.Fields.Append fldAddr16
 tdf.Fields.Append fldAddr17
 tdf.Fields.Append fldAddr18
 tdf.Fields.Append fldAddr19
 tdf.Fields.Append fldAddr20
 tdf.Fields.Append fldAddr21
 tdf.Fields.Append fldAddr22
 tdf.Fields.Append fldAddr23
 tdf.Fields.Append fldAddr24
 tdf.Fields.Append fldAddr25
 tdf.Fields.Append fldAddr26



 db.TableDefs.Append tdf

 db.TableDefs.Refresh
 Application.RefreshDatabaseWindow


 Set fldAddr1 = Nothing
 Set fldAddr2 = Nothing
 Set fldAddr3 = Nothing
 Set fldAddr4 = Nothing
 Set fldAddr5 = Nothing
 Set fldAddr6 = Nothing
 Set fldAddr7 = Nothing
 Set fldAddr8 = Nothing
 Set fldAddr9 = Nothing
 Set fldAddr10 = Nothing
 Set fldAddr11 = Nothing
 Set fldAddr12 = Nothing
 Set fldAddr13 = Nothing
 Set fldAddr14 = Nothing
 Set fldAddr15 = Nothing
 Set fldAddr16 = Nothing
 Set fldAddr17 = Nothing
 Set fldAddr18 = Nothing
 Set fldAddr19 = Nothing
 Set fldAddr20 = Nothing
 Set fldAddr21 = Nothing
 Set fldAddr22 = Nothing
 Set fldAddr23 = Nothing
 Set fldAddr24 = Nothing
 Set fldAddr25 = Nothing
 Set fldAddr26 = Nothing

 Set tdf = Nothing
 Set db = Nothing
 'wpis danych
Dim strSQL As String
strSQL = "INSERT INTO Export_DPD ( R_Name, R_Address, S_Email, R_Zip, R_City, R_Phone, R_Email, R_Contact_Person, P_Cat_KP, P_Courier_Name, S_Name, S_Address, S_Zip, S_City, S_Phone, S_Contact_Person, [Time] ) SELECT 'Jan Mróz' AS Wyr1, 'Sztokcholmska' AS Wyr2, 'aaa@wp.pl' AS Wyr17, '71-234' AS Wyr3, 'Kasina Wielko' AS Wyr4, '123456789' AS Wyr5, 'Costam@wp.pl' AS Wyr6, 'Jan Mróz' AS Wyr7, 1 AS Wyr8, 'DPD' AS Wyr9, 'Jakaś firma' AS Wyr15, 'Okrągła' AS Wyr14, '02-223' AS Wyr13, 'Warsaawa' AS Wyr12, '123456789' AS Wyr11, 'AAA' AS Wyr10, 'normal' AS Wyr16;"

DoCmd.RunSQL strSQL
Technical Details
Message-ID: <9855de16-1d3c-48bf-9fb2-680665a7a5c1@googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!n6no911272qtd.0!news-out.google.com!j8ni3416qtc.0!nntp.google.com!p16no909911qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
References: <39d994b6-e28e-4fc2-a084-f06f776fd643@googlegroups.com> <o1ncda$qom$1@node2.news.atman.pl> <o1nfag$hsc$1@node1.news.atman.pl> <o1orp2$7gg$1@node2.news.atman.pl> <8d5717d3-690b-486a-bbb8-04c4fd33b492@googlegroups.com> <o1plht$odp$1@node1.news.atman.pl>

Show Full Headers
Complete Article Headers
X-Received: by 10.99.0.142 with SMTP id 136mr19581727pga.148.1480620492557;        Thu, 01 Dec 2016 11:28:12 -0800 (PST)
X-Received: by 10.157.17.167 with SMTP id v36mr2737704otf.12.1480620492482; Thu, 01 Dec 2016 11:28:12 -0800 (PST)
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!n6no911272qtd.0!news-out.google.com!j8ni3416qtc.0!nntp.google.com!p16no909911qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: pl.comp.bazy-danych.msaccess
Date: Thu, 1 Dec 2016 11:28:12 -0800 (PST)
In-Reply-To: <o1plht$odp$1@node1.news.atman.pl>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=37.47.173.90; posting-account=PWJ4IAoAAAAF14TuSAASrVsGQI86DsCf
NNTP-Posting-Host: 37.47.173.90
References: <39d994b6-e28e-4fc2-a084-f06f776fd643@googlegroups.com> <o1ncda$qom$1@node2.news.atman.pl> <o1nfag$hsc$1@node1.news.atman.pl> <o1orp2$7gg$1@node2.news.atman.pl> <8d5717d3-690b-486a-bbb8-04c4fd33b492@googlegroups.com> <o1plht$odp$1@node1.news.atman.pl>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9855de16-1d3c-48bf-9fb2-680665a7a5c1@googlegroups.com>
Subject: Re: export kwerendy do pliku csv
From: Jan Koc <jan.kociumbas@gmail.com>
Injection-Date: Thu, 01 Dec 2016 19:28:12 +0000
Lines: 166
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit