Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: Says all records are null

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Says all records are null
"BW" <basic8[ at ]hotmail.com> 11.07.2006 04:50:40
I have the following code loaded on a simple for with a command button to
execute it. When I run this code it tells me every time that the [duedate]
field is always null. I open up the query and can clearly see that there
are dates in this field for most records but it never recognized them. I'm
sure I''ve got some thing wrong in here that is causing it. Thanks in
Advance...


Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim holdingdate As Date

rs.Open "qrybase1", CurrentProject.Connection, adOpenDynamic, adLockReadOnly

Do Until rs.EOF

If IsNull(rs!MaxOfDueDate) = True Then
holdingdate = DateSerial(Year(Date), Month(Date), 1)
Else
holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
End If

Do While Month(holdingdate) = Month(Date)
rs1.Open "tblwofile", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
rs1.AddNew
rs1!siteid = rs!siteid
rs1!WorkRequired = "Required"
rs1!WorkCategory = "Base One"
rs1!OpenDate = holdingdate
rs1!duedate = holdingdate
rs1!ClientID = rs!ClientID
rs1.Update
rs1.Close
holdingdate = holdingdate + rs!DaysBetweenJobs
Loop

rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set rs1 = Nothing


Re: Says all records are null
"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> 11.07.2006 09:39:24
Hi,
at what line you have this error? null in rs!DaysBetweenJobs can be a cause
of this error

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"BW" <basic8[ at ]hotmail.com> wrote in message
news:ekPoTWKpGHA.2464[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
>I have the following code loaded on a simple for with a command button to
>execute it. When I run this code it tells me every time that the
>[duedate] field is always null. I open up the query and can clearly see
>that there are dates in this field for most records but it never recognized
>them. I'm sure I''ve got some thing wrong in here that is causing it.
>Thanks in Advance...
>
>
> Dim rs As New ADODB.Recordset
> Dim rs1 As New ADODB.Recordset
> Dim holdingdate As Date
>
> rs.Open "qrybase1", CurrentProject.Connection, adOpenDynamic,
> adLockReadOnly
>
> Do Until rs.EOF
>
> If IsNull(rs!MaxOfDueDate) = True Then
> holdingdate = DateSerial(Year(Date), Month(Date), 1)
> Else
> holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
> End If
>
> Do While Month(holdingdate) = Month(Date)
> rs1.Open "tblwofile", CurrentProject.Connection, adOpenDynamic,
> adLockOptimistic
> rs1.AddNew
> rs1!siteid = rs!siteid
> rs1!WorkRequired = "Required"
> rs1!WorkCategory = "Base One"
> rs1!OpenDate = holdingdate
> rs1!duedate = holdingdate
> rs1!ClientID = rs!ClientID
> rs1.Update
> rs1.Close
> holdingdate = holdingdate + rs!DaysBetweenJobs
> Loop
>
> rs.MoveNext
> Loop
> rs.Close
> Set rs = Nothing
> Set rs1 = Nothing
>

Re: Says all records are null
"BW" <basic8[ at ]hotmail.com> 11.07.2006 12:07:02
These lines at the very beginning..

[Quoted Text]
> If IsNull(rs!MaxOfDueDate) = True Then
> holdingdate = DateSerial(Year(Date), Month(Date), 1)
> Else
> holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
> End If

"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> wrote in message
news:uE0si3MpGHA.1440[ at ]TK2MSFTNGP03.phx.gbl...
> Hi,
> at what line you have this error? null in rs!DaysBetweenJobs can be a
> cause of this error
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://alexdyb.blogspot.com
> http://www.PointLtd.com
>
> "BW" <basic8[ at ]hotmail.com> wrote in message
> news:ekPoTWKpGHA.2464[ at ]TK2MSFTNGP03.phx.gbl...
>>I have the following code loaded on a simple for with a command button to
>>execute it. When I run this code it tells me every time that the
>>[duedate] field is always null. I open up the query and can clearly see
>>that there are dates in this field for most records but it never
>>recognized them. I'm sure I''ve got some thing wrong in here that is
>>causing it. Thanks in Advance...
>>
>>
>> Dim rs As New ADODB.Recordset
>> Dim rs1 As New ADODB.Recordset
>> Dim holdingdate As Date
>>
>> rs.Open "qrybase1", CurrentProject.Connection, adOpenDynamic,
>> adLockReadOnly
>>
>> Do Until rs.EOF
>>
>> If IsNull(rs!MaxOfDueDate) = True Then
>> holdingdate = DateSerial(Year(Date), Month(Date), 1)
>> Else
>> holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
>> End If
>>
>> Do While Month(holdingdate) = Month(Date)
>> rs1.Open "tblwofile", CurrentProject.Connection, adOpenDynamic,
>> adLockOptimistic
>> rs1.AddNew
>> rs1!siteid = rs!siteid
>> rs1!WorkRequired = "Required"
>> rs1!WorkCategory = "Base One"
>> rs1!OpenDate = holdingdate
>> rs1!duedate = holdingdate
>> rs1!ClientID = rs!ClientID
>> rs1.Update
>> rs1.Close
>> holdingdate = holdingdate + rs!DaysBetweenJobs
>> Loop
>>
>> rs.MoveNext
>> Loop
>> rs.Close
>> Set rs = Nothing
>> Set rs1 = Nothing
>>
>


Re: Says all records are null
"Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> 11.07.2006 13:15:45
Hi,
perhaps rs!DaysBetweenJobs can have a null, then you can convert it to 0:

holdingdate = (rs!MaxOfDueDate + Nz(rs!DaysBetweenJobs,0))

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

"BW" <basic8[ at ]hotmail.com> wrote in message
news:OnE0LLOpGHA.4032[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> These lines at the very beginning..
>
>> If IsNull(rs!MaxOfDueDate) = True Then
>> holdingdate = DateSerial(Year(Date), Month(Date), 1)
>> Else
>> holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
>> End If
>
> "Alex Dybenko" <alexdyb[ at ]PLEASE.cemi.NO.rssi.SPAM.ru> wrote in message
> news:uE0si3MpGHA.1440[ at ]TK2MSFTNGP03.phx.gbl...
>> Hi,
>> at what line you have this error? null in rs!DaysBetweenJobs can be a
>> cause of this error
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://alexdyb.blogspot.com
>> http://www.PointLtd.com
>>
>> "BW" <basic8[ at ]hotmail.com> wrote in message
>> news:ekPoTWKpGHA.2464[ at ]TK2MSFTNGP03.phx.gbl...
>>>I have the following code loaded on a simple for with a command button to
>>>execute it. When I run this code it tells me every time that the
>>>[duedate] field is always null. I open up the query and can clearly see
>>>that there are dates in this field for most records but it never
>>>recognized them. I'm sure I''ve got some thing wrong in here that is
>>>causing it. Thanks in Advance...
>>>
>>>
>>> Dim rs As New ADODB.Recordset
>>> Dim rs1 As New ADODB.Recordset
>>> Dim holdingdate As Date
>>>
>>> rs.Open "qrybase1", CurrentProject.Connection, adOpenDynamic,
>>> adLockReadOnly
>>>
>>> Do Until rs.EOF
>>>
>>> If IsNull(rs!MaxOfDueDate) = True Then
>>> holdingdate = DateSerial(Year(Date), Month(Date), 1)
>>> Else
>>> holdingdate = (rs!MaxOfDueDate + rs!DaysBetweenJobs)
>>> End If
>>>
>>> Do While Month(holdingdate) = Month(Date)
>>> rs1.Open "tblwofile", CurrentProject.Connection, adOpenDynamic,
>>> adLockOptimistic
>>> rs1.AddNew
>>> rs1!siteid = rs!siteid
>>> rs1!WorkRequired = "Required"
>>> rs1!WorkCategory = "Base One"
>>> rs1!OpenDate = holdingdate
>>> rs1!duedate = holdingdate
>>> rs1!ClientID = rs!ClientID
>>> rs1.Update
>>> rs1.Close
>>> holdingdate = holdingdate + rs!DaysBetweenJobs
>>> Loop
>>>
>>> rs.MoveNext
>>> Loop
>>> rs.Close
>>> Set rs = Nothing
>>> Set rs1 = Nothing
>>>
>>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net