using a variable to filter

S

Stu_Mc

Hi guys

A colleague has written quite a large database and has now found a problem
and come to me for advice. My memory ain't what it was, hence this question.

Variables are set by selecting from a combo boxes and the values stored in
public variables called F1 F2 and F3.

When you open up another form from the main form it seems to pass the
variables over as the initial filter is carried out successfully, but the
remaining filters that apply to 2 additional drop down lists are not
functioning. The F1 F2 and F3 values are not being passed to the form at all
(checked using a watch in the VB Debug) but the initial filter is working
somehow.

The crux of the question is..... given that the variables are public, and
are in the MAIN module of the database, how can we use the values contained
in them to filter?

I've tried using VAL(F2) etc in the query but still get nothing. Forgive me
as its a few years since I worked on Access - my employer prefers VFP!

Any help would be gratefully recieved!

Cheers guys!
 
J

John W. Vinson

The crux of the question is..... given that the variables are public, and
are in the MAIN module of the database, how can we use the values contained
in them to filter?

Cut out the middleman - just be sure the form with the combo boxes is still
open (it can be invisible) and use

=Forms![NameOfForm]![NameOfCombo]

as a criterion. Public variables cease to exist under some circumstances and
can be a real pain to maintain.
 
S

Stu_Mc

Thanks for the reply John

I have already tried this but it doesn't work for some reason. The forms are
both open but it doesn't seem to use the value from the combo box.

I have checked that the filter works as it should by putting in actual
values but I just can't get it to read the values from the combo box.

Just going to find a hard surface to bang my head against!
 
J

John W. Vinson

Thanks for the reply John

I have already tried this but it doesn't work for some reason. The forms are
both open but it doesn't seem to use the value from the combo box.

I have checked that the filter works as it should by putting in actual
values but I just can't get it to read the values from the combo box.

Just going to find a hard surface to bang my head against!

Please post the SQL view of your query, or if you're setting a filter in code,
post the code.
 

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