trouble with filter by Form criteria

G

Guest

I have created a Form based on a Query that displays records in a Month of
30days old, 180days old etc. This "Followup" Form has two Subforms attached -
1. updateable subform to add followup dates to the Main Table; 2. Client
History subform (shows all records for each Client displayed).

These Forms are attached to a Filter Dialog (by command buttons) by which I
select a Month from a ComboBox. Each Query is set to read this Date(month)
field. I select the Month, then hit the 30 Day command button which gives me
that Form to use on Client Followup.

Result is no records display on the Form. When I run the Query by itself,
records display - after typing the Month required.

If I remove the perameter in the Query to read the Month from the Dialog
Form, All records display fine on the Followup Form. ALSO, if I remove the
Subforms + include the Date Perameter on the query, the Followup Form also
displays records correctly.

How can I get this to work?

thanks
 
S

strive4peace

What is the code that tuns when you click the 3-day command
button? Do you have a statement to Requery the subform?

me.subform_controlname.form.requery

Are you using LinkMasterFields and LinkChildFields on your
subform control? Perhaps this would be preferable to using
criteria in a query.


Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 
G

Guest

Thanks S4P, I re-created the Forms from scratch. I don't know what happened
before as they are now working fine. There were no codes returned before when
I selected the 30-day report control button, Form opened but displayed blank.
bazaar... Links between Master/Child were done right as it now works fine.

Although when I run the 'analize performance' on the Form it returns an IDEA
to use Option explicit statements that may enhance it. As I am not an expert
with access and code writing with Visual Basics not too sure about this one.

It seems to be working alright but hope it doesn't jeapardise stability.

thanks
 
S

strive4peace

you're welcome, I'm glad you got it working

--- Option Explicit ---

It is always a good idea to DIMension your variables before
you use them

Dim mStr As String

to force variable delaration (which I HIGHLY recommend), put
this at the top of your module:

Option Explicit

you can do Tools, Options... and check "require variable
declaration" so that any new modules created will have the
Option Explicit statement automatically at the top.

Another handy thing in declaring variables is that, if
Access recognizes the variable name you have typed as a
variable that has been dimensioned, it will change the case
for you after you move off the line.

mstr --> mStr

***

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/sgfsosample.asp

--- Quote---
"Option Explicit" is used,
because declared variable access is
slightly faster than undeclared variable
access. It also prevents bugs from
creeping into your code,
such as when you misspell
DriveTypeCDROM as DriveTypeCDORM.
--- end quote ---


Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

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