Option Group Problem (1 Viewer)

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
I have a FORM which is based on Query with Parameter BETWEEN [ENTER START DATE] AND [ENTER END DATE]. Within this form there is an OPTION GROUP that filters records based on Group field.

The problem is that when I enter the form the Query will run with the parameter to enter the start date and end date, the same parameter will run again when I select any check box from the OPTION GROUP, so I have to enter start date and end date twice to get the records I need filtered. How can I solve this problem? Basically what I need is to execute the parameter only once I enter the form. Note that when I remove the parameter from the query option group works fine but then I won't be able to select the dates I need to view their records.

Help is much appreciated
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
try this instead:

Code:
>=[From which date do you want records filtered?] And <=[until when?]

Also I have learned how to base a query on what is entered in a form ( see attachment)
 

Attachments

  • param.zip
    88 KB · Views: 220

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
This works but?

Thanks for the quick reply, the code works but again twice, when i first enter the form and when i select any check box from the Option Group to filter.

How can i make this parameter run after i select from the option group or only when i enter the form.

Thanks,
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
1) Do you have any other fields that have any other criteria?

2) does it still do this when you are directly opening the query from the database window?
 

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
here is the DB

Thanks again,

I attached the DB to clear the problem out, pls go to the WEEKLYEDITFRM, and from there try to select any radio button from SELECT YOUR UNIT.

1. In fact there is no other field with other criteria.
2. No, it it works fine from the query itself.

I hope this is clear now.
 

Attachments

  • Test.zip
    44.2 KB · Views: 122

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
I got it working. enjoy
 

Attachments

  • Working Test.zip
    74.4 KB · Views: 123

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
That's even greater than my idea, thanks so much for the time you spent on correcting my problem.

I really appreciate it.

Good day,
 

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
Just one little thing

hi,
One more thing i noticed, it does not match the unit's items when i selecte the unit and then input the start and end date.

I hope fixing this is easy.
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
othmanyg said:
hi,
One more thing i noticed, it does not match the unit's items when i selecte the unit and then input the start and end date.

I hope fixing this is easy.
Yeah, I noticed that. I was wondering why you had it like that.
try changing the default view to "Single Form" in the form properties
 

Mile-O

Back once again...
Local time
Today, 04:01
Joined
Dec 10, 2002
Messages
11,316
smercer said:
Code:
>=[From which date do you want records filtered?] And <=[until when?]

That is the exact same as Between ... And ...

As you then say, base it off a form. The Parameter method is prone to error as it doesn't differentiate between data types and opens the query even if there are no results.
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
Mile-O-Phile said:
That is the exact same as Between ... And ...

As you then say, base it off a form. The Parameter method is prone to error as it doesn't differentiate between data types and opens the query even if there are no results.
Mile in my attachment you will find that it is Referencing a form
 

Mile-O

Back once again...
Local time
Today, 04:01
Joined
Dec 10, 2002
Messages
11,316
smercer said:
Mile in my attachment you will find that it is Referencing a form

I guessed that. I was only commenting on the Between .. And
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
Mile-O-Phile said:
I guessed that. I was only commenting on the Between .. And
He asked a specific question and I anwsered a specific anwser
 

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
That did not work

Hello,

That did not help, It is not filtering now, i just need to filter by unit, how can I do that.

Help is really needed here.
Thanks
 

smercer

Registered User.
Local time
Today, 13:01
Joined
Jun 14, 2004
Messages
442
I forgot to add a bit of code. anyway I have changed it so it is all filtered by the query, since you have it based on the query anyway.
 

Attachments

  • Working Test2.zip
    77 KB · Views: 119

othmanyg

Registered User.
Local time
Today, 04:01
Joined
Feb 1, 2000
Messages
43
Great, it is wonderful now

I don't know how to thank you smercer for your great effort to solve this problem. Now it works exactly the way i wanted.

The code will also help me in the other databases i developed.

I wish i could return this help.
Best Regards
 

Users who are viewing this thread

Top Bottom