Have an Access DB "StoreDB.mdb, with a table called "data" and a date field called "BusDate". If you replace the {#" & DateRange & "#"} with {#9/30/2003#"}, as an example, it works. The value shown in the locals view is correct. What is up?
This code should work, shouldn't it?
Sub GetTable()
Dim DbEngine As Database
Dim rs As Recordset
Dim strSQL As String
Dim DateRange As String
DateRange = Range("Date"
Set DbEngine = OpenDatabase("C:\Sales\StoreDB.mdb"
strSQL = "SELECT * FROM Data WHERE BusDate = #" & DateRange & "#"
Set rs = DbEngine.OpenRecordset(strSQL)
Range("A1"
.CopyFromRecordset rs
End Sub
Dean
This code should work, shouldn't it?
Sub GetTable()
Dim DbEngine As Database
Dim rs As Recordset
Dim strSQL As String
Dim DateRange As String
DateRange = Range("Date"
Set DbEngine = OpenDatabase("C:\Sales\StoreDB.mdb"
strSQL = "SELECT * FROM Data WHERE BusDate = #" & DateRange & "#"
Set rs = DbEngine.OpenRecordset(strSQL)
Range("A1"
End Sub
Dean