Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Update a Database From Excel
Hi All,
I am excuting a sql query to a DB to set a Field value to equal the current date:- The problem I have is in Cell A1 I get left "ExternalData_163" I added the Range("A1").Select and Selection.Clear to the end of the macro but it seems to get over looked. I changed the Refresh to .Refresh 'BackgroundQuery:=False but i get the following error messege " Run-time error '1004': Application-defined or object-defined error" Is there a way to send an update statement to a DB without the output been sent to the Worksheet? Many Thanks Mark Sub Update_Details_Sent() Range("A1").Value = Now() Range("A1").Select Selection.NumberFormat = "yyymmdd" NewDate = Range("A1").Text SQLQuery = "" SQLQuery = SQLQuery & "Update Stage1 Set ExcelDate = '" & NewDate & "' " SQLQuery = SQLQuery & "where ExcelDate = '20050101' " connstring = "ODBC;DSN=*******;Database=********" With ActiveSheet.QueryTables.Add(Connection:=connstring , _ Destination:=Range("A1"), Sql:=SQLQuery) .Refresh End With Range("A1").Select Selection.Clear End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Security update KB905756 problem with Excel 2003 | Excel Discussion (Misc queries) | |||
How do I update data in 3 related files in Excel? | Excel Discussion (Misc queries) | |||
Excel Links Update | Links and Linking in Excel | |||
how to automate invoice using excel database | Excel Discussion (Misc queries) | |||
Update a Database Using Excel | Excel Worksheet Functions |