Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro help needed to update db with variable

Status
Not open for further replies.

rnemeth

MIS
Nov 6, 2003
1
0
0
US
I;m trying to create a macro that will update an Oracle table with my cube completion times, however, I cannot get the macro to pass the variable date into the table.
Below is the macro I'm testing. I want a record added to the table that gives module id, which for this example is 200, module description, which in this case is shipments, the start date, which is where I want the varDate to be read in from the current system date, start time, whichI've hard coded in this example, but this would also eventually be a variable that would be read in, and end time.
Any help would be appreciated.
Thanks,
Rich


Sub Main
' Declarations

Dim connection As Long
Dim retcode As Long
Dim varDate as Variant

varDate = CVar(Date)
' Open the Data Source
connection = SQLOpen("DSN=odsdev;UID=HNAD;PWD=PASSWORD", outputStr,prompt:=3)

query = " insert into rich_test values ('200','SHIPMENTS',varDate,'8:00','9:00')"
retcode = SQLExecQuery(connection,query)

retcode = SQLClose(connection)

End Sub
 
I usually use ADO however ... you might try enclosing the date variable in single quotes.

ie:

"'" + varDate + "'"

If you display the value of the date using a MsgBox, is it in a format that is recognized by Oracle?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top