Board index » delphi » Object variable or With block variable not set Error

Object variable or With block variable not set Error

I have a visual basic Active X control that I import into my Delphi 5
project.  When I call the Active X function SetTransaction I get the error
"Object variable or With block variable not set."  So I wrote a VB program
that calls the same function and it too gave the same error "Error 91 Object
variable or With block variable not set."  I then found out the VB Active X
control was referencing MSComCtl.OCX which I did not have on the system.  I
registered this OCX file and my VB program worked fine without giving me
this error.  But my Delphi program, even after registering the OCX file
still gives me the same error.  My visual basic code and my delphi code are
basically the same (except for syntax).

Here is the visual basic code:

    Set objPms = CreateObject("ACEIVTK.ACEComm")
    mintstatus = objPms.SetTransaction(Val(TxtTranscode.Text))
    Set objPms = Nothing

Here is the Delphi Code:

procedure TForm1.Button1Click(Sender: TObject);
var
 nTrnType, nResult : SmallInt;
begin
 nTrnType := 20;
 nResult := AceComm1.SetTransaction(nTrnType);
 ShowMessage(IntToStr(nResult));
end;

I have the visual basic active x source code.  And have put in message boxes
to tell me how far I get before receiving this error.  It runs through much
of the active x code until it calls a status form with a MSComCtl status
component:

    Load frmstatus
    frmstatus.Show
    frmstatus.Caption = frmstatus.Caption & msDisplayString

At the point it tries to Show the status form it errors out.

Anyone have any ideas?
Thanks in advance for any suggestions:

Jake Johnson

 

Re:Object variable or With block variable not set Error


While debugging in VB, I would set error trapping to Break On All Errors to
determine what line exactly causes the error. This might be some kind of
failure in the GotFocus or Activate event of frmStatus.

--
have fun
Binh Ly
http://www.techvanguards.com

Quote
"Jake Johnson" <jacob.john...@ndchealth.com> wrote in message

news:3b324db9_1@dnews...
Quote
>     Load frmstatus
>     frmstatus.Show
>     frmstatus.Caption = frmstatus.Caption & msDisplayString

> At the point it tries to Show the status form it errors out.

> Anyone have any ideas?

Re:Object variable or With block variable not set Error


Thanks for the response,
actually I can't run it through the de{*word*81} because my VB programmer is
across the country and he just puts msg boxes in there for me to look at,
and he can't figure out how to run the de{*word*81} with my delphi program as
the host application.  He did take off all the components on the VB form so
all that shows is a form and I still get the error "Object variable or With
block variable not set."   Has anyone called a VB DLL that created and
showed a form?  Does it actually work?  I am guessing that the problem is in
the way Delphi creates the Type Library Information???  Any other thoughts?

Jake Johnson

Quote
"Binh Ly" <b...@castle.net> wrote in message news:3b32bca4$1_1@dnews...
> While debugging in VB, I would set error trapping to Break On All Errors
to
> determine what line exactly causes the error. This might be some kind of
> failure in the GotFocus or Activate event of frmStatus.

> --
> have fun
> Binh Ly
> http://www.techvanguards.com

> "Jake Johnson" <jacob.john...@ndchealth.com> wrote in message
> news:3b324db9_1@dnews...
> >     Load frmstatus
> >     frmstatus.Show
> >     frmstatus.Caption = frmstatus.Caption & msDisplayString

> > At the point it tries to Show the status form it errors out.

> > Anyone have any ideas?

Other Threads