Open form based on query

Nero

Shop smart, shop S-Mart
Local time
Today, 00:53
Joined
Jan 8, 2002
Messages
217
Hi,
Been away from Access for a long time so please bear with me.
I have a pop-up form which allows the user to open a main form based upon different queries.
The problem I'm having is the main form is opening but showing all records and not filtered.
If for example the user selects all records with a value of over £5000, when opened the form returns all records not just the filtered ones.
If I run the query on it's own it works fine showing me the filtered records.

Any ideas ?
 
How are you passing the filter conditions to the query to filter the data?
Is the form using the same underlying query as the one being filtered?

David
 
Have you based the form of the query?
What does the query look like?
Have you considered using the "filter" or "where" part of the Docmd.Openform command?

Edit:
LOL Crosspost with David, very simular post
 
Last edited:
Hi,
The main form is based on a table.
I am using the following to open the form.

Code:
Case 4
    If DCount("*", "QryFilter2") > 0 Then
        DoCmd.Close acForm, "frmMenu"
        DoCmd.OpenForm "frmSPAllDetails", acNormal, "qryFilter21"
        DoCmd.Close acForm, "frmSPFilterOption"
    Else
        MsgBox "No records for criteria", vbInformation, "Message"
        Exit Sub
    End If

I have used this many times in the past with no problems.
When I was developing in the past I used Access2K
This is in 2K3. I have had a few other quirky things happen that worked fine in 2K.

Thanks,
Kev
 
Code:
If DCount("*", "[B]QryFilter2[/B]") > 0 Then
        DoCmd.Close acForm, "frmMenu"
        DoCmd.OpenForm "frmSPAllDetails", acNormal, "[B]qryFilter21[/B]"
        DoCmd.Close acForm, "frmSPFilterOption"
    Else
        MsgBox "No records for criteria", vbInformation, "Message"
        Exit Sub
    End If

is this a typo or not? shouldn't these 2 be the same?
 
Yeh sorry.
They are the same query
 
I'll see if I can trim the DB down and send it.
 
You can also just open the query in SQL view, then copy and paste that here.
 

Users who are viewing this thread

Back
Top Bottom