how to insert getdate function using vba

Bharat Kumar

i want to retrieve date from sql server not from system. so i use getdate function but it not working in vba here is code and error

 conn.Execute "insert into dbo.Customers (AccountNo,Amount,code) values ('" & AccountNo & "', '" & Amount & "', '" & getdate() & "')"
Mitch Wheat

You want getdate() to be executed by SQL Server, not VBA. You have quotes in the wrong place around getdate():

conn.Execute "insert into dbo.Customers (AccountNo, Amount, code) values ('" & AccountNo & "', '" & Amount & "', getdate())"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to insert a function into a cell with VBA?

calculate how to get GETDATE() -4 using customer function in SQL

The sequence is not correct when using insert into function in VBA

how to filter an array using getDate()?

Using relative/abs references to insert a function using VBA

getdate() function

GetDate Function

How to use if function using VBA

How to select data using getdate() + time?

How can I Insert each row With getdate() + 20 second

How to insert a repeating <td> in react using a function

How to insert code into function using a stringed equation?

How to insert multiple rows using a function in PostgreSQL

How to insert data in postgresql using for loop function?

VBA: How to insert Symbol based on cell value using character number

How to properly add column to the Excel table and insert a formula using VBA

How to insert values into the database table using VBA in MS access

How to insert formula with specific characters using VBA script correctly

How do I Insert a String That Starts With = Into a Cell Value Using VBA?

How to insert text into Outlook email editor using VBA

How to insert variable value into getpivotdata formula using excel vba macro

How to insert row above/below groups in a column using VBA

How to insert a specific value at the beginning of text in a Column using Excel VBA?

How to copy or insert multiple range data in InnerText using Excel VBA

GETDATE() function in SQL server

getDate Function python

Using the insert function in a class

Insert Function using strcmp()

Using insert into where not exists in VBA