Query Criteria help.

G

Guest

I am using a true or false criteria in a query like this in the criteria field:

Whats_Status("Varname")

The function is defined like this:
Public Function Whats_Status(Varname As Boolean) As Boolean
Whats_Status = varname
End Function

Varname is publ.ic

But I am getting an " unknown jet error"
What am I doing wrong?

Mike
 
J

John Vinson

I am using a true or false criteria in a query like this in the criteria field:

Whats_Status("Varname")

The function is defined like this:
Public Function Whats_Status(Varname As Boolean) As Boolean
Whats_Status = varname
End Function

Varname is publ.ic

But I am getting an " unknown jet error"
What am I doing wrong?

Mike

You're passing a text string "Varname" into a parameter which is
defined as Boolean, for one thing. Try Whats_Status(Varname As
String). You will probably also need to use

Whats_Status = Eval(Varname)

to evaluate the value of the variable defined by varname.

John W. Vinson[MVP]
 
J

John Vinson

but the field in the query is a true/false. So that is why I made it boolean.

Mike

You're passing the function a parameter "Varname". That is a literal
text string. It is not a boolean, and the definition of the function
is expecting you to pass a Boolean value (True or False, or
equivalently -1 or 0), NOT a text string.

Could you explain the logic here? Exactly what are you trying to
accomplish? Where does the value of varname get set? Why are you using
varname as both a string constant, and as a variable (I'm guessing
this is an example for the purpose of this newsgroup post, not
actually how you would use the function)?

John W. Vinson[MVP]
 
G

Guest

Sorry for the confusion, but that's because I am.
I have a query on a table w/ a boolean. I want to put a variable(boolean)
in a module in a form w/ an option box. Depending on which one is chosen,
the variable is a true or false. I then would do the query using the
criteria in the field.
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top