Boolean function in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a db that I am working on that needs to use code developed in VB.
This code is supposed to be pasted into a module and functions called from
it. I have pasted the code and went to compile it and received a sub or
function not defined error on the line of code below.
FDB_AEXP_Dateinamen = BOOL(FDB_VB_AEXP_DATEINAMEN(sDatNam, sIndNam, sStatus))

The error is on the Bool. The FDB_VB_AEXP_DATEINAMEN returns a value of Long.
Any suggestions on how to handle this in VBA.

TIA,
Tasha
 
There's no BOOL function built into Access, so presumably it's a custom
written one that you need to paste into a module as well.

Either that, or if FDB_VB_AEXP_DATEINAMEN returns 0 in some cases, and a
number in others and you want to convert that to False for 0 and True for
any non-zero value, you can use CBool rather than BOOL.
 
If you're sure that the only purpose of this function was to convert the
Long value to a Boolean value, then you can use the CBool() function.
However, I'd check with the person who gave you this code, because I'm
fairly sure that CBool() works the same way in VB6 that it does in VBA, so I
wonder why the VB programmer would have written a function to do that?
Perhaps the function does something more?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thank you both Brendan and Douglas for your quick reply. I found where the
original programmer defined the function.
 
Tasha said:
Thank you both Brendan and Douglas for your quick reply. I found where the
original programmer defined the function.


Just for future reference, the VBE provides a nice feature
that helps out in this kind of thing. just click in the
name of whatever thing you want to know more about and then
click the View - Definition menu item.

If the thing is a built-in name, then hitting the F1 key
will occasionally bring the appropriate Help topic ;-\
 
Back
Top