Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default import access dates into xl "calendar"

import access dates into xl calendar

Hello, hopefully you can help me out with a concept I'm struggling with,

I've got a Tasks table in Access with 3 fields: task names, start dates, and
due dates. I'd like to export this data into Excel so that the excel columns
are days of the month (1-31 columns). The rows would contain the Tasks data,
such that a task whose start date falls on the 5th of the month and whose due
date falls on the 31st of the month would fill a unique color to cells 5-31.
Essentially, this would be like a task calendar.

Is this at all possible? any help much appreciated, thanks
Dave


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default import access dates into xl "calendar"

I experimented with this and it seems to work. If someone doesn't post
anything else maybe you can use it:


Sub getData()

Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset

'connect to the database
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source='C:\Tasks.mdb'"

'select all tasks that start in july
cmd.ActiveConnection = cn
cmd.CommandText = "SELECT * FROM Tasks " & _
"WHERE Start Between " & _
"#7/1/2007# And #7/31/2007#"

Set rs = cmd.Execute

rs.MoveFirst

'color index
cl = 5

'starting row
i = 1

'color the cells
Do While Not rs.EOF

st = DatePart("d", rs.Fields("Start"))
due = DatePart("d", rs.Fields("Due"))

Sheets(1).Cells(i, st) = rs.Fields("Name")

For j = st To due
Sheets(1).Cells(i, j) = _
Sheets(1).Cells(i, j) & " " & j
Sheets(1).Cells(i, j).Interior.ColorIndex = cl
Next
rs.MoveNext

i = i + 1
cl = cl + 1

Loop

End Sub



--
urkec


"DaveMZ" wrote:

import access dates into xl calendar

Hello, hopefully you can help me out with a concept I'm struggling with,

I've got a Tasks table in Access with 3 fields: task names, start dates, and
due dates. I'd like to export this data into Excel so that the excel columns
are days of the month (1-31 columns). The rows would contain the Tasks data,
such that a task whose start date falls on the 5th of the month and whose due
date falls on the 31st of the month would fill a unique color to cells 5-31.
Essentially, this would be like a task calendar.

Is this at all possible? any help much appreciated, thanks
Dave


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default import access dates into xl "calendar"

Thanks urkec, that code works great. I'll play around with it to get the look
I need.

cheers

"urkec" wrote:

I experimented with this and it seems to work. If someone doesn't post
anything else maybe you can use it:


Sub getData()

Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset

'connect to the database
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source='C:\Tasks.mdb'"

'select all tasks that start in july
cmd.ActiveConnection = cn
cmd.CommandText = "SELECT * FROM Tasks " & _
"WHERE Start Between " & _
"#7/1/2007# And #7/31/2007#"

Set rs = cmd.Execute

rs.MoveFirst

'color index
cl = 5

'starting row
i = 1

'color the cells
Do While Not rs.EOF

st = DatePart("d", rs.Fields("Start"))
due = DatePart("d", rs.Fields("Due"))

Sheets(1).Cells(i, st) = rs.Fields("Name")

For j = st To due
Sheets(1).Cells(i, j) = _
Sheets(1).Cells(i, j) & " " & j
Sheets(1).Cells(i, j).Interior.ColorIndex = cl
Next
rs.MoveNext

i = i + 1
cl = cl + 1

Loop

End Sub



--
urkec


"DaveMZ" wrote:

import access dates into xl calendar

Hello, hopefully you can help me out with a concept I'm struggling with,

I've got a Tasks table in Access with 3 fields: task names, start dates, and
due dates. I'd like to export this data into Excel so that the excel columns
are days of the month (1-31 columns). The rows would contain the Tasks data,
such that a task whose start date falls on the 5th of the month and whose due
date falls on the 31st of the month would fill a unique color to cells 5-31.
Essentially, this would be like a task calendar.

Is this at all possible? any help much appreciated, thanks
Dave


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
ACCESS ="NO" BUT EXCEL DISPLAYS "0" pauld Excel Discussion (Misc queries) 2 March 12th 09 02:11 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 09:57 AM.

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"