Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
i don't know if any body can helps me on this issue i wrote a code as below but no data goes to recordset i think this is because of date format or something like this because i can copy the fieds name the vaiables FrstDate shows "12/31/2009" and LstDate shows "1/28/2010" please help. Sub bbb() Dim rst As New ADODB.Recordset Dim conn As New ADODB.Connection Dim str1 As String Dim sID As String Dim iCost As Integer str1 = "" sID = "" Dim sPN As String sPN = "" Dim i As Integer Dim j As Integer iCost = 0 If Now - 31 < "12/31/2009" Then FrstDay = "12/31/2009" Else FrstDay = Left(Now - 31, 9) End If LstDate = Left(Now, 9) str1 = "Driver={MySQL ODBC 3.51 Driver};Server=192.168.1.155;DATABASE=DSS;UID=root ;option = 1+2+8+32+2048+163841" conn.CursorLocation = adUseClient conn.ConnectionString = str1 conn.Open rst.Open "select * from big where R_Date " & FrstDay & " and R_Date <" & LstDate, conn rstrows = rst.RecordCount For iCols = 0 To rst.Fields.Count - 1 ActiveSheet.Cells(1, iCols + 1).Value = rst.Fields(iCols).Name Next ActiveSheet.Range(ActiveSheet.Cells(1, 1), _ ActiveSheet.Cells(1, rst.Fields.Count)).Font.Bold = True ActiveSheet.Range("A2").CopyFromRecordset rst rst.Close conn.Close End Sub -- Farhad Hodjat |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
updating data from Access | Excel Discussion (Misc queries) | |||
Removing Data Tables formed from importing data from Access | Excel Discussion (Misc queries) | |||
Can Excel access data from Access?! | Excel Discussion (Misc queries) | |||
Access data | Excel Discussion (Misc queries) | |||
Importing Data from Access | Excel Discussion (Misc queries) |