Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 281
Default Getting data from MS Access

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
updating data from Access Ruth Excel Discussion (Misc queries) 2 September 4th 09 07:53 PM
Removing Data Tables formed from importing data from Access Andrea Jones Excel Discussion (Misc queries) 0 April 10th 08 12:01 PM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
Access data C Tate Excel Discussion (Misc queries) 2 December 9th 05 06:17 PM
Importing Data from Access Jon_h2 Excel Discussion (Misc queries) 2 October 14th 05 11:15 AM


All times are GMT +1. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"