Discussion:
"the object invoked has disconnected from" using intrinsic grid ct
(too old to reply)
Brad Ashforth
2007-10-22 20:16:02 UTC
Permalink
We have suddently started getting this error. We have the following code
snippet:

grd.Col = 1: grd.Text = rs.Fields("WR_VesselID").Value
grd.Col = 2: grd.Text = Trim(cboVessel.Text)
grd.Col = 3: grd.Text =
Format(NVL(rs.Fields("WR_SumInsured").Value, 0), "#0.00000")
grd.Col = 4: grd.Text = rs.Fields("WR_WarRiskZone").Value
grd.Col = 5: grd.Text = NVL(rs.Fields("WR_DateIn").Value, "")
grd.Col = 6: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 7: grd.Text = NVL(rs.Fields("WR_DateOut").Value, "")
grd.Col = 8: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 9: grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
grd.Col = 10: grd.Text = NVL(rs.Fields("WR_Debit").Value,
"0.00000")
grd.Col = 11: grd.Text = NVL(rs.Fields("WR_Discount").Value,
"0.00000")
grd.Col = 12: grd.Text = NVL(rs.Fields("WR_Credit").Value,
"0.00000")
grd.Col = 13: grd.Text = NVL(rs.Fields("WR_Net").Value, "0.00000")
grd.Col = 14: grd.Text = IIf(NVL(rs.Fields("WR_Paid").Value, 0)
<> 0, "Yes", "No")

Stepping through the code, we will get a few lines in and then it will fail
with the msg "the object invoked has disconnected from one of its clients".
The rs object uses ADO and on the failed row I can hover over the
rs.fields(<colname>).value and it will correctly display what I'd expect to
see. Similarlly I can check it's value in the immediate window without error.
But it will fail when trying to set grd.text the value. I did an internet
search for "the object invoked has disconnected from" and found several posts
on the subject, none seem to apply. The form in question DOES use a date/time
picker and I had seen a post blaming mscal.ocx and when checked I did find
that the mscal.ocx in my Office10 folder WAS newer ... but it made no
difference. Please help if you can ... Thank you in advance.
--
Brad Ashforth
Jan Hyde (VB MVP)
2007-10-23 08:01:20 UTC
Permalink
Brad Ashforth <***@nospam.nospam>'s wild thoughts were
released on Mon, 22 Oct 2007 13:16:02 -0700 bearing the
Post by Brad Ashforth
We have suddently started getting this error. We have the following code
grd.Col = 1: grd.Text = rs.Fields("WR_VesselID").Value
grd.Col = 2: grd.Text = Trim(cboVessel.Text)
grd.Col = 3: grd.Text =
Format(NVL(rs.Fields("WR_SumInsured").Value, 0), "#0.00000")
grd.Col = 4: grd.Text = rs.Fields("WR_WarRiskZone").Value
grd.Col = 5: grd.Text = NVL(rs.Fields("WR_DateIn").Value, "")
grd.Col = 6: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 7: grd.Text = NVL(rs.Fields("WR_DateOut").Value, "")
grd.Col = 8: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 9: grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
grd.Col = 10: grd.Text = NVL(rs.Fields("WR_Debit").Value,
"0.00000")
grd.Col = 11: grd.Text = NVL(rs.Fields("WR_Discount").Value,
"0.00000")
grd.Col = 12: grd.Text = NVL(rs.Fields("WR_Credit").Value,
"0.00000")
grd.Col = 13: grd.Text = NVL(rs.Fields("WR_Net").Value, "0.00000")
grd.Col = 14: grd.Text = IIf(NVL(rs.Fields("WR_Paid").Value, 0)
<> 0, "Yes", "No")
Stepping through the code, we will get a few lines in and then it will fail
with the msg "the object invoked has disconnected from one of its clients".
The rs object uses ADO and on the failed row I can hover over the
rs.fields(<colname>).value and it will correctly display what I'd expect to
see. Similarlly I can check it's value in the immediate window without error.
But it will fail when trying to set grd.text the value. I did an internet
search for "the object invoked has disconnected from" and found several posts
on the subject, none seem to apply. The form in question DOES use a date/time
picker and I had seen a post blaming mscal.ocx and when checked I did find
that the mscal.ocx in my Office10 folder WAS newer ... but it made no
difference. Please help if you can ... Thank you in advance.
What is the source property of the error object?

Check the errors collection of your recordset to eliminate
that as a possibility.

Can you set the text property in the immediate window once
the error occurs?


--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Brad Ashforth
2007-10-23 17:17:02 UTC
Permalink
Hi Jan. Thanks for your help.

What is the source property of the error object?
?err.source = TRPolicy
Please note that TRPolicy is the name of the DLL project currently running
(e.g. the project that contains the code that is not working)

?err.LastDllError
0

Check the errors collection of your recordset to eliminate
that as a possibility.
In this case, the code fails on this line:
grd.Col = 9: grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
If I hover over the rs object code, I see a value of 0.05, which is correct.
?rs.Fields("WR_Rate").Value
0.05
?cntc.Errors.Count --- cntc is the ado.connection object used to open the rs
object
0


Can you set the text property in the immediate window once
the error occurs?
Now THIS may have given us some useful info. Since the value was .05 I
executed:
grd.txt = "0.05" and did not get an error
I then executed
?NVL(rs.Fields("WR_Rate").Value, "0.00000")
0.05
I then executed
grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
and got the error!
So, I then thought to save the recordset value to a variable and then set
the grid.text to that variable, as in:
strRowData = NVL(rs.Fields("WR_Rate").Value, "0.00000")
grd.Text = strrowdata

and it worked! So although it appears I may have a workaround, this is still
very strange! Any additional info would be most appreciated. In the
meanwhile I will try to use the workaround above and continue testing

Thanks!
--
Brad Ashforth
Post by Jan Hyde (VB MVP)
released on Mon, 22 Oct 2007 13:16:02 -0700 bearing the
Post by Brad Ashforth
We have suddently started getting this error. We have the following code
grd.Col = 1: grd.Text = rs.Fields("WR_VesselID").Value
grd.Col = 2: grd.Text = Trim(cboVessel.Text)
grd.Col = 3: grd.Text =
Format(NVL(rs.Fields("WR_SumInsured").Value, 0), "#0.00000")
grd.Col = 4: grd.Text = rs.Fields("WR_WarRiskZone").Value
grd.Col = 5: grd.Text = NVL(rs.Fields("WR_DateIn").Value, "")
grd.Col = 6: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 7: grd.Text = NVL(rs.Fields("WR_DateOut").Value, "")
grd.Col = 8: grd.Text = NVL(rs.Fields("WR_TimeIn").Value, "")
grd.Col = 9: grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
grd.Col = 10: grd.Text = NVL(rs.Fields("WR_Debit").Value,
"0.00000")
grd.Col = 11: grd.Text = NVL(rs.Fields("WR_Discount").Value,
"0.00000")
grd.Col = 12: grd.Text = NVL(rs.Fields("WR_Credit").Value,
"0.00000")
grd.Col = 13: grd.Text = NVL(rs.Fields("WR_Net").Value, "0.00000")
grd.Col = 14: grd.Text = IIf(NVL(rs.Fields("WR_Paid").Value, 0)
<> 0, "Yes", "No")
Stepping through the code, we will get a few lines in and then it will fail
with the msg "the object invoked has disconnected from one of its clients".
The rs object uses ADO and on the failed row I can hover over the
rs.fields(<colname>).value and it will correctly display what I'd expect to
see. Similarlly I can check it's value in the immediate window without error.
But it will fail when trying to set grd.text the value. I did an internet
search for "the object invoked has disconnected from" and found several posts
on the subject, none seem to apply. The form in question DOES use a date/time
picker and I had seen a post blaming mscal.ocx and when checked I did find
that the mscal.ocx in my Office10 folder WAS newer ... but it made no
difference. Please help if you can ... Thank you in advance.
What is the source property of the error object?
Check the errors collection of your recordset to eliminate
that as a possibility.
Can you set the text property in the immediate window once
the error occurs?
--
Jan Hyde
https://mvp.support.microsoft.com/profile/Jan.Hyde
Jan Hyde (VB MVP)
2007-10-24 07:56:11 UTC
Permalink
Brad Ashforth <***@nospam.nospam>'s wild thoughts were
released on Tue, 23 Oct 2007 10:17:02 -0700 bearing the
Post by Brad Ashforth
Hi Jan. Thanks for your help.
What is the source property of the error object?
?err.source = TRPolicy
Please note that TRPolicy is the name of the DLL project currently running
(e.g. the project that contains the code that is not working)
?err.LastDllError
0
Check the errors collection of your recordset to eliminate
that as a possibility.
grd.Col = 9: grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
If I hover over the rs object code, I see a value of 0.05, which is correct.
?rs.Fields("WR_Rate").Value
0.05
?cntc.Errors.Count --- cntc is the ado.connection object used to open the rs
object
0
Can you set the text property in the immediate window once
the error occurs?
Now THIS may have given us some useful info. Since the value was .05 I
grd.txt = "0.05" and did not get an error
I then executed
?NVL(rs.Fields("WR_Rate").Value, "0.00000")
0.05
I then executed
grd.Text = NVL(rs.Fields("WR_Rate").Value, "0.00000")
and got the error!
So, I then thought to save the recordset value to a variable and then set
strRowData = NVL(rs.Fields("WR_Rate").Value, "0.00000")
grd.Text = strrowdata
and it worked! So although it appears I may have a workaround, this is still
very strange! Any additional info would be most appreciated. In the
meanwhile I will try to use the workaround above and continue testing
Thanks!
What does NVL do?


--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Ralph
2007-10-24 12:32:16 UTC
Permalink
"Jan Hyde (VB MVP)" <***@REMOVE.ME.uboot.com> wrote in message news:***@4ax.com...
<snipped>
Post by Jan Hyde (VB MVP)
What does NVL do?
MSDN Help:
"Returns a non-null value from two expressions."
...
"Use NVL( ) to remove null values from calculations or operations where null
values are not supported or are not relevant."

Think of it as an IIf that doesn't blow up if an expression is null.
Jan Hyde (VB MVP)
2007-10-24 15:53:15 UTC
Permalink
"Ralph" <***@yahoo.com>'s wild thoughts were
released on Wed, 24 Oct 2007 07:32:16 -0500 bearing the
Post by Ralph
<snipped>
Post by Jan Hyde (VB MVP)
What does NVL do?
"Returns a non-null value from two expressions."
...
"Use NVL( ) to remove null values from calculations or operations where null
values are not supported or are not relevant."
Think of it as an IIf that doesn't blow up if an expression is null.
That's not a function that is available in VB6 is it? So I
guess the question is, has the OP written his own version or
is the OP's code something other than VB




--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Ralph
2007-10-24 19:38:35 UTC
Permalink
Post by Jan Hyde (VB MVP)
released on Wed, 24 Oct 2007 07:32:16 -0500 bearing the
<snipped>
Post by Jan Hyde (VB MVP)
That's not a function that is available in VB6 is it? So I
guess the question is, has the OP written his own version or
is the OP's code something other than VB
Yeah, I knew where you were going and was being a bit silly. <g>
It certainly looks like ADO, but the "VB" part is a bit suspicious.

Did you notice this bit?
IIf(NVL(rs.Fields("WR_Paid").Value, 0) <> 0, "Yes", "No")
Walter Wang [MSFT]
2007-10-25 00:49:57 UTC
Permalink
I'm not aware that VB6 has this function, MSDN also shows Visual Foxpro has
one function named NVL(). According to Brad's original posting, I think he
should be using VB6 code.

Anyway, Brad, if you need to continue working on this, please post your
implementation of NVL(). Thanks.


Regards,
Walter Wang (***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Loading...