I get a run time error "invalid use of Null" on the dtCompleteDate field. Any ideas how I would handle this?
Sub GetRefundData(CriteriaWR)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim intEnterWR As Variant
intEnterWR = [CriteriaWR]
strSQL = "SELECT WRInquiry.* FROM WRInquiry Where CD_WR = " & intEnterWR & ";"
Dim stProjectID, stPremise, stArea, stCustName, stJobAddress, stBillName, stBillAdd, stBillCity, stBillState, stBillZip, stOpUnit, stUtilityType, stActivityID, stStatus, stWRDesc, stTypeWR, stJobType As String
Dim dtCompleteDate As Date
Dim intWRNumber As Variant
Dim intTotal As Currency
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
With rst
intWRNumber = rst![CD_WR]
stPremise = rst![ID_PREMISE]
stArea = rst![CD_AREA]
stCustName = rst![NM_CONTACT]
stJobAddress = rst![JobAddress]
stBillName = rst![NM_CONTACT]
stBillAdd = rst![Address]
stBillCity = rst![AD_TOWN]
stBillState = rst![CD_STATE]
stBillZip = rst![AD_POSTAL]
stOpUnit = rst![CD_CREWHQ_FIN]
stUType = rst![IND_UTIL]
stActivityID = rst![CD_WR]
stStatus = rst![CD_STATUS]
stWRDesc = rst![DS_WR]
stTypeWR = rst![TP_WR]
stJobType = rst![TP_JOB]
It fails at this point, if the DT_COMPLETE is Null
dtCompleteDate = rst![DT_COMPLETE]
intTotal = rst![QuoteAmount]
stProjectID = rst![CD_WO_INSTL]
Any help would be appreciated. Thanks!
Sub GetRefundData(CriteriaWR)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim intEnterWR As Variant
intEnterWR = [CriteriaWR]
strSQL = "SELECT WRInquiry.* FROM WRInquiry Where CD_WR = " & intEnterWR & ";"
Dim stProjectID, stPremise, stArea, stCustName, stJobAddress, stBillName, stBillAdd, stBillCity, stBillState, stBillZip, stOpUnit, stUtilityType, stActivityID, stStatus, stWRDesc, stTypeWR, stJobType As String
Dim dtCompleteDate As Date
Dim intWRNumber As Variant
Dim intTotal As Currency
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
With rst
intWRNumber = rst![CD_WR]
stPremise = rst![ID_PREMISE]
stArea = rst![CD_AREA]
stCustName = rst![NM_CONTACT]
stJobAddress = rst![JobAddress]
stBillName = rst![NM_CONTACT]
stBillAdd = rst![Address]
stBillCity = rst![AD_TOWN]
stBillState = rst![CD_STATE]
stBillZip = rst![AD_POSTAL]
stOpUnit = rst![CD_CREWHQ_FIN]
stUType = rst![IND_UTIL]
stActivityID = rst![CD_WR]
stStatus = rst![CD_STATUS]
stWRDesc = rst![DS_WR]
stTypeWR = rst![TP_WR]
stJobType = rst![TP_JOB]
It fails at this point, if the DT_COMPLETE is Null
dtCompleteDate = rst![DT_COMPLETE]
intTotal = rst![QuoteAmount]
stProjectID = rst![CD_WO_INSTL]
Any help would be appreciated. Thanks!