Subform Filter by Form not filtering when using Access built int Filter by Form

  • Thread starter cyberwolf0000 via AccessMonster.com
  • Start date
C

cyberwolf0000 via AccessMonster.com

Hi all,

I have a form with a linked subform. They are linked master Field =
EstToActID, Linked Child Field = EstToActID. When I use Access Filter by
Form, it brings up the empty form and subform. When I use the main form and
filter on a field there it works fine, but when I use the subform, it does
not apply the filter, I still get all of the records in both the from and
subform.

Any ideas as to why?


TIA,

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
C

cyberwolf0000 via AccessMonster.com

cyberwolf0000 said:
Hi all,

I have a form with a linked subform. They are linked master Field =
EstToActID, Linked Child Field = EstToActID. When I use Access Filter by
Form, it brings up the empty form and subform. When I use the main form and
filter on a field there it works fine, but when I use the subform, it does
not apply the filter, I still get all of the records in both the from and
subform.

Any ideas as to why?

TIA,

I forgot to add that there are 3 fields on the subform that can be filtered
"VerID", "PcQty" & "WastePct". The main form is called frm_EstToAct and the
subform is called VerInfo_subform,

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
C

cyberwolf0000 via AccessMonster.com

Never Mind, I got it figured out based on previous posts and code from Allen
Browne. Once again Allen comes to the rescue. Thanks Allen you are the best.

[quoted text clipped - 8 lines]

I forgot to add that there are 3 fields on the subform that can be filtered
"VerID", "PcQty" & "WastePct". The main form is called frm_EstToAct and the
subform is called VerInfo_subform,

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
G

get subforms filter string in VBA via AccessMonste

Now I am having another issue. I have the following code in the Apply Filter
event on my subform:

Dim strSQL As String
Dim strFilter As String

strFilter = Me.Filter

If CurrentProject.AllForms("frm_EstToActSingle").IsLoaded Then
If ApplyType = 1 And strFilter <> "" Then
strSQL = "SELECT EstToAct.* " & _
"FROM EstToAct LEFT JOIN VerInfo ON EstToAct.EstToActID = VerInfo.
EstToActID " & _
"WHERE " & strFilter
Forms!frm_EstToActSingle.RecordSource = strSQL
Else
Forms!frm_EstToActSingle.RecordSource = "EstToAct"
End If
ElseIf CurrentProject.AllForms("frm_EstToActCont").IsLoaded Then
If ApplyType = 1 And strFilter <> "" Then
strSQL = "SELECT EstToAct.* " & _
"FROM EstToAct LEFT JOIN VerInfo ON EstToAct.EstToActID = VerInfo.
EstToActID " & _
"WHERE " & strFilter
Forms!frm_EstToActCont.RecordSource = strSQL
Else
Forms!frm_EstToActCont.RecordSource = "EstToAct"
End If
End If

Whenever I start moving through a recordset that has been filtered my Access
errors and closes. I have been able to narrow it down to this event, because
I removed the event trigger and did not get this issue. I am willing to bet
that it is because the Apply Filter event fires whenever you move to a new
record.
Never Mind, I got it figured out based on previous posts and code from Allen
Browne. Once again Allen comes to the rescue. Thanks Allen you are the best.
[quoted text clipped - 5 lines]
"VerID", "PcQty" & "WastePct". The main form is called frm_EstToAct and the
subform is called VerInfo_subform,

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 
G

get subforms filter string in VBA via AccessMonste

So far so good. Now my question is, when I apply the below SQL string to my
recordsource I need to move to the next record and then back for it to apply
properly.

Can anyone help me figure this out.

BTW, I needed to reinstall Office to get rid of the error & close issue.
Now I am having another issue. I have the following code in the Apply Filter
event on my subform:

Dim strSQL As String
Dim strFilter As String

strFilter = Me.Filter

If CurrentProject.AllForms("frm_EstToActSingle").IsLoaded Then
If ApplyType = 1 And strFilter <> "" Then
strSQL = "SELECT EstToAct.* " & _
"FROM EstToAct LEFT JOIN VerInfo ON EstToAct.EstToActID = VerInfo.
EstToActID " & _
"WHERE " & strFilter
Forms!frm_EstToActSingle.RecordSource = strSQL
Else
Forms!frm_EstToActSingle.RecordSource = "EstToAct"
End If
ElseIf CurrentProject.AllForms("frm_EstToActCont").IsLoaded Then
If ApplyType = 1 And strFilter <> "" Then
strSQL = "SELECT EstToAct.* " & _
"FROM EstToAct LEFT JOIN VerInfo ON EstToAct.EstToActID = VerInfo.
EstToActID " & _
"WHERE " & strFilter
Forms!frm_EstToActCont.RecordSource = strSQL
Else
Forms!frm_EstToActCont.RecordSource = "EstToAct"
End If
End If

Whenever I start moving through a recordset that has been filtered my Access
errors and closes. I have been able to narrow it down to this event, because
I removed the event trigger and did not get this issue. I am willing to bet
that it is because the Apply Filter event fires whenever you move to a new
record.
Never Mind, I got it figured out based on previous posts and code from Allen
Browne. Once again Allen comes to the rescue. Thanks Allen you are the best.
[quoted text clipped - 4 lines]

--
James B Gaylord
For the Wolf comes the strength of the Pack,
For the Pack comes the strength of the Wolf,
-R. Kipling
Office 2003 on Win XP SP2
 

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