Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing from access


i have the below that imports data from a access recorded from a macro.
I want to pick up a date from another sheet to use as the
(ts_i_hist_agent_data.row_date={ts '2006-08-08 00:00:00'})

i have tried using a my as date and copying the date to mydate but this
doesnt work?

Also i have to enter a password each time i run this where in the code
can i put in the pass word so i dont have to do this each time? ive
tried chaning save password to true but no joy?


Range("A1").Select

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _

"ODBC;Description=dialler_access;DRIVER=SQL
Server;SERVER=wrkvictohok13be;UID=dialler_access;; APP=Microsoft Office
2003;WSID=WRKQUEEN" _

), Array("SRK4EC4")), Destination:=Range("A1"))

..CommandText = Array( _

"SELECT ts_i_hist_agent_data.agent_id,
ts_i_hist_agent_data.alloc, ts_i_hist_agent_data.avail,
ts_i_hist_agent_data.camp_id, ts_i_hist_agent_data.ccr_id,
ts_i_hist_agent_data.row_date, ts_i_hist_agent_" _

, _

"data.row_hour, ts_i_hist_agent_data.talk,
ts_i_hist_agent_data.wrap" & Chr(13) & "" & Chr(10) & "FROM
d_dialler.dbo.ts_i_hist_agent_data ts_i_hist_agent_data" & Chr(13) & ""
& Chr(10) & "WHERE (ts_i_hist_agent_data.row_date={ts '2006-08-08
00:00:00'})" _

)

..Name = "Query from dialler_access"

..FieldNames = True

..RowNumbers = False

..FillAdjacentFormulas = False

..PreserveFormatting = True

..RefreshOnFileOpen = False

..BackgroundQuery = True

..RefreshStyle = xlInsertDeleteCells

..SavePassword = True

..SaveData = True

..AdjustColumnWidth = True

..RefreshPeriod = 0

..PreserveColumnInfo = True

..Refresh BackgroundQuery:=False

End With

End Sub


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=570400

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default importing from access

s = format(Worksheets("Sheet1").Range("A1").Value,"yyy y-mm-dd 00:00:00")


then

(ts_i_hist_agent_data.row_date={ts '" & s & "'})

--
Regards,
Tom Ogilvy


"ceemo" wrote:


i have the below that imports data from a access recorded from a macro.
I want to pick up a date from another sheet to use as the
(ts_i_hist_agent_data.row_date={ts '2006-08-08 00:00:00'})

i have tried using a my as date and copying the date to mydate but this
doesnt work?

Also i have to enter a password each time i run this where in the code
can i put in the pass word so i dont have to do this each time? ive
tried chaning save password to true but no joy?


Range("A1").Select

With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _

"ODBC;Description=dialler_access;DRIVER=SQL
Server;SERVER=wrkvictohok13be;UID=dialler_access;; APP=Microsoft Office
2003;WSID=WRKQUEEN" _

), Array("SRK4EC4")), Destination:=Range("A1"))

.CommandText = Array( _

"SELECT ts_i_hist_agent_data.agent_id,
ts_i_hist_agent_data.alloc, ts_i_hist_agent_data.avail,
ts_i_hist_agent_data.camp_id, ts_i_hist_agent_data.ccr_id,
ts_i_hist_agent_data.row_date, ts_i_hist_agent_" _

, _

"data.row_hour, ts_i_hist_agent_data.talk,
ts_i_hist_agent_data.wrap" & Chr(13) & "" & Chr(10) & "FROM
d_dialler.dbo.ts_i_hist_agent_data ts_i_hist_agent_data" & Chr(13) & ""
& Chr(10) & "WHERE (ts_i_hist_agent_data.row_date={ts '2006-08-08
00:00:00'})" _

)

.Name = "Query from dialler_access"

.FieldNames = True

.RowNumbers = False

.FillAdjacentFormulas = False

.PreserveFormatting = True

.RefreshOnFileOpen = False

.BackgroundQuery = True

.RefreshStyle = xlInsertDeleteCells

.SavePassword = True

.SaveData = True

.AdjustColumnWidth = True

.RefreshPeriod = 0

.PreserveColumnInfo = True

.Refresh BackgroundQuery:=False

End With

End Sub


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=570400


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing from access


thats great thank you very much. Does anyone have any clues on the
password bit. also when i run it, it sets it up from scratch witch
moves the old date to the right to fit in the new data. is there anyway
i can just get it to refresh over the top of the old import without this
happening. i did think of deleteing the columns first but this will
interfer with formulas linking to those cells


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=570400

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing from access


does anyone know how to refresh with the new date raher than re-creatng
the query from scratch?


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=570400

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
Importing from Access sfleck Excel Worksheet Functions 2 January 31st 08 12:35 AM
Importing from Access Richard Excel Discussion (Misc queries) 1 October 19th 07 02:05 PM
Importing from Access Matt Dawson Excel Worksheet Functions 0 October 18th 06 03:38 PM
Importing data from Access to Excel, but I need to vary the table from Access Liz L. Excel Programming 3 June 6th 06 02:12 AM
Importing from MS Access jc Excel Programming 0 February 5th 04 03:15 PM


All times are GMT +1. The time now is 01:32 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"