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

right, i have a excel file with data in it. I can import the data into
access db, but once i get it into there i want a user to be able press
a button in excel that the goes and manipulates all the data that is in
the access db and then produce the results in a new excel file.

i'm having issues with the start of the code that manipulates the data
- the recordset does not seem to start and goes straight to the msgbox

strFilePath = ThisWorkbook.path
fileDBPath = strFilePath & "\cof.mdb"

strDBPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
fileDBPath
Set Conn = CreateObject("ADODB.Connection")
Conn.Open strDBPath

strSQL = "SELECT AutoNum, ORDER_STATUS_NOTE FROM POUpdateDetail WHERE
ORDER_STATUS_NOTE Like 'Requested Delivery Date Changed from*'"

Set rs = CreateObject("ADODB.Recordset")

Set rs = Conn.Execute(strSQL)

Do While Not rs.EOF

strAutoNum = rs("AutoNum")
strRFPDate = rs("ORDER_STATUS_NOTE")
strDate = Trim(Right(strRFPDate, 20))
strDate = Format(strDate, "dd/mm/yyyy")

strSQL = "UPDATE POUpdateDetail SET DelDate = '" & strDate & "'
WHERE AutoNum = " & strAutoNum
Conn.Execute (strSQL)

rs.MoveNext
Loop

rs.Close: Set rs = Nothing

Conn.Close: Set Conn = Nothing

MsgBox "Complete"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default data manipulation in access from Excel vba

Try ???
strSQL = "UPDATE POUpdateDetail SET DelDate = #" & strDate & "#"

HTH,
--
Gary Brown

If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.


" wrote:

right, i have a excel file with data in it. I can import the data into
access db, but once i get it into there i want a user to be able press
a button in excel that the goes and manipulates all the data that is in
the access db and then produce the results in a new excel file.

i'm having issues with the start of the code that manipulates the data
- the recordset does not seem to start and goes straight to the msgbox

strFilePath = ThisWorkbook.path
fileDBPath = strFilePath & "\cof.mdb"

strDBPath = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
fileDBPath
Set Conn = CreateObject("ADODB.Connection")
Conn.Open strDBPath

strSQL = "SELECT AutoNum, ORDER_STATUS_NOTE FROM POUpdateDetail WHERE
ORDER_STATUS_NOTE Like 'Requested Delivery Date Changed from*'"

Set rs = CreateObject("ADODB.Recordset")

Set rs = Conn.Execute(strSQL)

Do While Not rs.EOF

strAutoNum = rs("AutoNum")
strRFPDate = rs("ORDER_STATUS_NOTE")
strDate = Trim(Right(strRFPDate, 20))
strDate = Format(strDate, "dd/mm/yyyy")

strSQL = "UPDATE POUpdateDetail SET DelDate = '" & strDate & "'
WHERE AutoNum = " & strAutoNum
Conn.Execute (strSQL)

rs.MoveNext
Loop

rs.Close: Set rs = Nothing

Conn.Close: Set Conn = Nothing

MsgBox "Complete"


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
data manipulation in excel... vlookupabyss Excel Discussion (Misc queries) 0 January 8th 08 11:06 AM
Manipulation of Data extract from Access Database Chase Excel Discussion (Misc queries) 2 July 19th 07 07:42 AM
Data Manipulation - Excel 2000 sandralong2 via OfficeKB.com Excel Discussion (Misc queries) 2 November 9th 06 10:30 PM
For better Performance in VBA for Excel - Strings manipulation OR Objects manipulation vmegha Excel Programming 2 December 19th 05 12:14 AM
Code for Access file manipulation from Excel Tom Urtis Excel Programming 0 July 21st 05 08:31 AM


All times are GMT +1. The time now is 11:22 AM.

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

About Us

"It's about Microsoft Excel"