Access Stored Procedure error

I am changing some code and getting an error from SQL can anyone help?

Access code:
Dim DN, NS As String
Dim ED As Date
DN = "000000000578436"
NS = "Loaded"
ED = Format(Date, "YYYY/MM/DD")

        objCmd.CommandText = "sp_UpdateDespCustForm" & " '" & DN & "', '" & NS & ", '" & ED & "'"
        objCmd.ActiveConnection = adoConn
        Set objRs = objCmd.Execute

Open in new window

SQL Stored procedure:
@DespNote char(15), @Stage char(9), @EstDelDate nvarchar(10)
DELETE FROM [dbo].[CusMdnMaster+] WHERE DispatchNote = @DespNote and KeyInvoice= space(20)
set @EstDelDate= convert(datetime, @EstDelDate, 103)
INSERT INTO [dbo].[CusMdnMaster+] (DispatchNote, KeyInvoice, ProcessStage, DeliveryDate)
VALUES (@DespNote, space(20), @Stage, @EstDelDate)

Open in new window

SQL Error
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
@EstDelDate is nvarchar(10) and you're trying to store a datetime on it (set @EstDelDate= convert(datetime, @EstDelDate, 103))

If @EstDelDate is in this format 'YYYYMMDD' then you won't need any conversion and insert the value directly so SQL Server engine will convert it implicitly.
Éric MoreauSenior .Net ConsultantCommented:
declare your ED variable as string. I know it contains a date but since you format it, the result is a string.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HKFueyAuthor Commented:
Hi Guys,

I have now: "ED = Format(Date, "YYYYMMDD")" and Declared as string. It works!
HKFueyAuthor Commented:
Thank You!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.