Open form based on query (2 Viewers)

Nero

Shop smart, shop S-Mart
Local time
Today, 18:15
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 ?
 

DCrake

Remembered
Local time
Today, 18:15
Joined
Jun 8, 2005
Messages
8,626
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
 

namliam

The Mailman - AWF VIP
Local time
Today, 19:15
Joined
Aug 11, 2003
Messages
11,695
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:

Nero

Shop smart, shop S-Mart
Local time
Today, 18:15
Joined
Jan 8, 2002
Messages
217
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
 

DCrake

Remembered
Local time
Today, 18:15
Joined
Jun 8, 2005
Messages
8,626
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?
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:15
Joined
Jan 8, 2002
Messages
217
Yeh sorry.
They are the same query
 

Nero

Shop smart, shop S-Mart
Local time
Today, 18:15
Joined
Jan 8, 2002
Messages
217
I'll see if I can trim the DB down and send it.
 

DKO

Registered User.
Local time
Today, 19:15
Joined
Oct 16, 2007
Messages
47
You can also just open the query in SQL view, then copy and paste that here.
 

Users who are viewing this thread

Top Bottom