Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an excel file which queries a backend Access database using the code
below. The labeldate field is a date/time field in Access. When I run the query and get the data into a worksheet, Excel removes the time and just dumps the date. I tried formatting the labeldate field in Excel but it only shows the date. I ran the same query in Access and the labeldate field showed the full date and time in the query result. I need some help as to explain why the time is missing. strsql = "SELECT AddresseeCity, AddresseeState, mailingcity, senderstate, mailingstate, country, addresseename, addresseeaddress, " & _ "addresseezip, labeldate, labelnumber, mailservice, totalpostage, originzip, " & _ "WgtPkginLbs, ozs, flatrate FROM seizures WHERE " & _ "labeldate =#" & beg & "# and labeldate <=#" & fin & "# AND (addresseestate = '" & state & "');" cnn.Open stcon rst.Open strsql, cnn, adOpenForwardOnly, adLockOptimistic 'recs1 = rst.RecordCount Worksheets("Data").Select i = 1 For Each fld In rst.Fields ActiveSheet.Cells(1, i).Value = fld.Name i = i + 1 Next fld 'On Error Resume Next Worksheets("Data").Range("A2").CopyFromRecordset rst |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Editing time that has its colon removed | Excel Worksheet Functions | |||
Query automatically being removed | Excel Discussion (Misc queries) | |||
Time query | Excel Worksheet Functions | |||
Web Query Run-time Error | Excel Programming | |||
Excel time out query | Excel Programming |