![]() |
#1
|
|||
|
|||
![]()
I have the following code which doesn't seem to do anything on the above.
At this moment in time I'm just trying to read the CSV and use MSG Box to display field values. Can you please help? Option Explicit Private Sub BtnLoad_Click() On Error GoTo Err_Catch Err_Catch: Resume Next Dim Customer, Salutation, FirstName, Surname, Telephone, Mobile, SiteMobile, EMail, Address1, Address2, Address3, TownCity, _ PostCode, SageNo, CurrentStatus, DTA, SLADate, Services, BagLimit, Charge, ChargePeriod, Sites, strSQL As String Dim Bookmark, CurrentField As Range Dim CSVConnection As New ADODB.Connection Dim rs As New ADODB.Recordset Set CSVConnection = New ADODB.Connection Set rs = New ADODB.Recordset CSVConnection.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _ & path & ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False" strSQL = "SELECT * FROM Customer Report.csv" rs.Open strSQL, CSVConnection, adOpenStatic, adLockReadOnly Do While Not rs.EOF MsgBox rs(0) rs.MoveNext Loop If rs.RecordCount > 0 Then Do Customer = rs("Customer") Salutation = rs("Salutation") FirstName = rs("First Name") Surname = rs("Surname") Telephone = rs("Telephone") Mobile = rs("Mobile") SiteMobile = rs("Site Mobile") EMail = rs("EMail") Address1 = rs("Address 1") Address2 = rs("Address 2") Address3 = rs("Address 3") PostCode = rs("Post Code") SageNo = rs("Sage Account") CurrentStatus = rs("Current Status") DTA = rs("DTA Service") SLADate = rs("SLA Date") Services = rs("Current Services") BagLimit = rs("Bag Limit") Charge = rs("Charge") ChargePeriod = rs("Charge Period") Sites = rs("Sites") rs.MoveNext Loop Until rs.EOF End If rs.Close Set CSVConnection = Nothing End Sub |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Paste from one page to another doesnt place in the same place | MrShhh | Visio | 0 | 09-21-2016 05:47 AM |
![]() |
PeterPlys | Word VBA | 13 | 01-14-2015 06:41 AM |
![]() |
NienkeG | Word | 2 | 08-03-2014 03:57 PM |
![]() |
anurag.butoliya | Word | 1 | 06-14-2014 06:27 PM |
![]() |
Jamal NUMAN | Word | 8 | 09-04-2011 07:48 AM |