Advertisement

07.22.2008 at 07:11AM PDT, ID: 23585142
[x]
Attachment Details

Why is this statement occurring as "Invalid use of Null"

Asked by Chuckbuchan in Microsoft Visual Basic.Net, Microsoft Access Database

Tags: Visual Basic.NET, Invalid Use of Null

Dim QueryByDates As New OleDbCommand("EXEC INVENTORY_QUERY_BY_RANGE", UserDatabase)
            QueryByDates.Parameters.AddWithValue("@START_DATE", Convert.ToDateTime("01/01/1950"))
            QueryByDates.Parameters.AddWithValue("@END_DATE", Convert.ToDateTime(Now.ToString()))
            If mnuAR.Checked Then QueryByDates.Parameters.AddWithValue("@STATE", "1")

            QueryByDates.ExecuteNonQuery()

When I execute this code I get the error about an invalid use of null, but the query works perfectly in the Access database it is in.

I have attached the SQL access QueryStart Free Trial
1:
2:
3:
4:
5:
PARAMETERS START_DATE DateTime, END_DATE DateTime, STATE Short;
INSERT INTO INVENTORY ( FILENO, FORW_NO, CRED_NAME, FORW_FILENO, FORW_REFNO, PLAINTIFF_1, PLAINTIFF_2, PLAINTIFF_3, PLAINTIFF_4, PARA, COLLECTOR, NAME, STREET, STREET2, CITY, ST, ZIP, RET_MAIL, SSN, PHONE, FAX, EMP_NO, DATE_RECD, [#_ACCTS], ORIGINAL_CLAIM, BAL, LPAYMNT_DATE, LPAY_AMT, BKCY_CHAPTER, BKCY_FILENO, BKCY_FILED_DATE, ADVA, DOCKET_NO, DSMIS_DATE, SUIT_DATE, SERVICE_DATE, AF_DATE, JMT_DATE, JMT_AMOUNT, GARN_DATE, COST_EXPENDED, PRIN_COLLECTED, INT_COLLECTED, COST_REC, STAT_EARNED, PRIORITY, MATRIX_ID, [STAT1 CODE], STAT1_DATE, DATE_DEBT, PRE_J_RATE, [AMT OF 1ST MORTGAGE], [AMT OF 2ND MORTGAGE], MISC_CMT4, PAID_TO_DATE, LST_PMT_RANGE, [%_PAID], TOTAL_INT, TOTAL_DUE, STATUTE, SOL_DT )
SELECT dbo_Master.FILENO, dbo_Master.FORW_NO, dbo_Master.CRED_NAME, dbo_Master.FORW_FILENO, dbo_Master.FORW_REFNO, dbo_Master.PLAINTIFF_1, dbo_Master.PLAINTIFF_2, dbo_Extra.PLAINTIFF_3, dbo_Extra.PLAINTIFF_4, dbo_Master.PARA, dbo_Master.COLLECTOR, dbo_Debtor.NAME, dbo_Debtor.STREET, dbo_Debtor.STREET2, dbo_Debtor.CITY, dbo_Debtor.ST, Left(Trim([zip]),5) AS [ZIP-5], dbo_Debtor.RET_MAIL, dbo_Debtor.SSN, dbo_Debtor.PHONE, dbo_Debtor.FAX, dbo_Master.EMP_NO, dbo_Master.DATE_RECD, IIf([dbo_master.fileno] Is Not Null,1,"") AS [#_ACCTS], CCur([ORIG_CLAIM]) AS ORIGINAL_CLAIM, CCur([BALANCE]) AS BAL, dbo_Master.LPAYMNT_DATE, CCur([LPAYMNT_AMT]) AS LPAY_AMT, dbo_Debtor.BKCY_CHAPTER, dbo_Debtor.BKCY_FILENO, dbo_Debtor.BKCY_FILED_DATE, dbo_Master.ADVA, dbo_Master.DOCKET_NO, dbo_Debtor.DSMIS_DATE, dbo_Master.SUIT_DATE, dbo_Debtor.SERVICE_DATE, dbo_Debtor.AF_DATE, dbo_Master.JMT_DATE, CCur([dbo_Master.JMT_AMT]) AS JMT_AMOUNT, dbo_Debtor.GARN_DATE, CCur([COST_EXP]) AS COST_EXPENDED, CCur([PRIN_COLL]) AS PRIN_COLLECTED, CCur([INT_COLL]) AS INT_COLLECTED, CCur([COST_RECOVERED]) AS COST_REC, CCur([STAT_EARN]) AS STAT_EARNED, CInt(Trim([dbo_MASTER].[C_PRIORITY])) AS PRIORITY, dbo_MatrixUpt.MATRIX_ID, ([STAT1_CODE]*1) AS [STAT1 CODE], dbo_Master.STAT1_DATE, dbo_Master.DATE_DEBT, dbo_Master.PRE_J_RATE, Format([Col187],"Fixed") AS [AMT OF 1ST MORTGAGE], Format([Col189],"Fixed") AS [AMT OF 2ND MORTGAGE], dbo_Extra.MISC_CMT4, ([PRIN_COLLECTED]+[INT_COLLECTED]+[COST_RECOVERED]+[STAT_EARN]) AS PAID_TO_DATE, IIf([LPAYMNT_DATE] Is Null,"",IIf(([LPAYMNT_DATE]>[DATE_RECD] And [LPAYMNT_DATE]<Date()-181 And [PAID_TO_DATE]>0),"PMT OVER 180 DAYS",IIf(([LPAYMNT_DATE]<=Date()-91 And [LPAYMNT_DATE]>=Date()-180 And [LPAYMNT_DATE]>[DATE_RECD] And [PAID_TO_DATE]>0),"PMT 91 - 180 DAYS",IIf(([LPAYMNT_DATE]<=Date()-41 And [LPAYMNT_DATE]>=Date()-90 And [LPAYMNT_DATE]>[DATE_RECD] And [PAID_TO_DATE]>0),"PMT 41 - 90 DAYS",IIf(([LPAYMNT_DATE]>=Date()-40 And [LPAYMNT_DATE]>[DATE_RECD] And [PAID_TO_DATE]>0),"RECENT PMT"))))) AS LST_PMT_RANGE, ([PAID_TO_DATE]/[ORIG_CLAIM]) AS [%_PAID], IIf([dbo_MASTER.JMT_DATE] Is Null,IIf([DATE_DEBT] Is Not Null,CCur(((([PRE_J_RATE]/100)/365)*([BALANCE]-[COST_EXP]))*(Date()-[DATE_DEBT])+[ORIGINT]),CCur([ORIGINT])),CCur(((([POST_J_RATE]/100)/365)*[BALANCE])*(Date()-[dbo_MASTER.JMT_DATE]))) AS TOTAL_INT, ([TOTAL_INT]+[BALANCE]) AS TOTAL_DUE, StateSOL.STATUTE, IIf([LPAYMNT_DATE] Is Null,"",([LPAYMNT_DATE]+([STATUTE]*365))) AS SOL_DT
FROM (FORWARDERS INNER JOIN ((((((dbo_Debtor RIGHT JOIN dbo_Master ON dbo_Debtor.FILENO = dbo_Master.FILENO) LEFT JOIN dbo_MatrixUpt ON dbo_Master.FILENO = dbo_MatrixUpt.FILENO) LEFT JOIN dbo_Seg7 ON dbo_Master.FILENO = dbo_Seg7.PrimaryIndex) LEFT JOIN StateSOL ON dbo_Debtor.ST = StateSOL.STATE) LEFT JOIN dbo_DiaryINT ON dbo_Master.FILENO = dbo_DiaryINT.FILENO) LEFT JOIN dbo_Extra ON dbo_Master.FILENO = dbo_Extra.FILENO) ON FORWARDERS.FORW_NO = dbo_Master.FORW_NO) INNER JOIN FORWARDERS AS FORWARDERS_1 ON dbo_Master.FORW_NO = FORWARDERS_1.FORW_NO
WHERE (((dbo_Master.DATE_RECD) Between [START_DATE] And [END_DATE]) AND ((dbo_Master.SALES_NO)=[state]));
 
Loading Advertisement...
 
[+][-]07.22.2008 at 07:14AM PDT, ID: 22059577

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 07:26AM PDT, ID: 22059721

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 07:46AM PDT, ID: 22059981

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:10AM PDT, ID: 22060262

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:11AM PDT, ID: 22060274

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:13AM PDT, ID: 22060301

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:20AM PDT, ID: 22060377

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:24AM PDT, ID: 22060416

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:45AM PDT, ID: 22060641

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 08:49AM PDT, ID: 22060675

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 09:05AM PDT, ID: 22060842

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 09:16AM PDT, ID: 22060942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 09:16AM PDT, ID: 22060945

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 09:22AM PDT, ID: 22061009

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 09:30AM PDT, ID: 22061080

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 11:48AM PDT, ID: 22062359

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:25PM PDT, ID: 22063840

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, Microsoft Access Database
Tags: Visual Basic.NET, Invalid Use of Null
Sign Up Now!
Solution Provided By: alainbryden
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.23.2008 at 10:14AM PDT, ID: 22071493

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628