Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kissmarx
Starting Member
4 Posts |
Posted - 2003-11-11 : 05:01:26
|
rstrans.Open "Select est-DateDiff(mm, '" & DTPicker1.Value & "', '" & dtpicker2.value & "') as rld,acctcode,acctdesc,...", cnFixedAssetsAnyone can tell me what's wrong with my statement above?What I want to accomplished is to get the difference between a field (est)and the difference produced by two dates (dtpicker1 and dtpicker2)and display it in rld column but i always get an error "No value given for one or more required parameter"I code it in a VB6 embedded SQL. Thanks in advance!!! |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-11-11 : 05:55:11
|
What happens if you take out the dataediff?This looks ok - might have problems with the date formatformat(DTPicker1.Value, "yyyymmdd") would be better.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-11-11 : 08:37:43
|
Still better for him would be to look at the result of:MsgBox _"Select est-DateDiff(mm, '" & DTPicker1.Value & "', '" & dtpicker2.value & "') as rld,acctcode,acctdesc,..." |
|
|
kissmarx
Starting Member
4 Posts |
Posted - 2003-11-11 : 23:01:55
|
Thanks for your comments, however I still encounter the same erroreven if i simplify the statement:rstrans.Open "Select DateDiff(mm, #" & DTPicker1.Value & "#, #" & dtpicker2.value & "#) as rld",cnFixedAssetsWhat could be missing????? |
|
|
kissmarx
Starting Member
4 Posts |
Posted - 2003-11-11 : 23:07:22
|
Changing the dateformat couldnt solved the error.My final statement: ..correction from my previous post(produced also the same error)rstrans.Open "Select DateDiff(mm, #" & DTPicker1.Value & "#, #" & dtpicker2.value & "#) as rld from trans",cnFixedAssets |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-11-12 : 03:28:33
|
Try this (don't forget to remove single quotes):DateDiff(mm, " & CDate(DTPicker1.Value) & ", '" &Just in case if it is Access. Should be "m" instead of mm. |
|
|
kissmarx
Starting Member
4 Posts |
Posted - 2003-11-12 : 20:37:15
|
Hi Stoad. I'm helpless!It's still not working.....But I really thank you for helping me. |
|
|
|
|
|
|
|