Filter Frustration

I have two forms.  Both have a button that call the same subform.

This is the information for the first call.  It works just fine.
________________________________________
    stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
Me!DEVCODE & "'"
    stDocName = "MilestoneDates"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
________________________________________

This is the information for the second call.  The Seasons portion works but 
the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
then the other)
________________________________________
    stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
Me!TrackingNo & "'"
    stDocName = "MilestoneDates"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
________________________________________

The type (Text), format (none specified), information (indexed, no 
duplicates) and even number of characters (255) is all the same between the 
DEVCODE field and the TrackingNo field.  They are in two different tables.

Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 4:52:03 PM
access.forms 6864 articles. 2 followers. Follow

6 Replies
595 Views

Similar Articles

[PageSpeed] 56

Should the criteria string in the second form read like this:

stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [TrackingNo]='" & 
Me!TrackingNo & "'"

I replaced [DevCodeA] with [TrackingNo]...

Danny

"hntsignif" wrote:

> I have two forms.  Both have a button that call the same subform.
> 
> This is the information for the first call.  It works just fine.
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!DEVCODE & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> This is the information for the second call.  The Seasons portion works but 
> the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> then the other)
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!TrackingNo & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> The type (Text), format (none specified), information (indexed, no 
> duplicates) and even number of characters (255) is all the same between the 
> DEVCODE field and the TrackingNo field.  They are in two different tables.
> 
> Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 4:59:07 PM
No [DevCodeA] and [SEASONS] are the fields on the form I am opening.  It is 
the same form as the one opened in in the first example.  The only thing that 
changes is that the second form I am drawing from has the name of the field 
changed in order to separate the tables.  The first example is from the table 
Inline and the second is associated with the table MarcomPackaging.

"Danny" wrote:

> Should the criteria string in the second form read like this:
> 
> stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [TrackingNo]='" & 
> Me!TrackingNo & "'"
> 
> I replaced [DevCodeA] with [TrackingNo]...
> 
> Danny
> 
> "hntsignif" wrote:
> 
> > I have two forms.  Both have a button that call the same subform.
> > 
> > This is the information for the first call.  It works just fine.
> > ________________________________________
> >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > Me!DEVCODE & "'"
> >     stDocName = "MilestoneDates"
> >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > ________________________________________
> > 
> > This is the information for the second call.  The Seasons portion works but 
> > the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> > then the other)
> > ________________________________________
> >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > Me!TrackingNo & "'"
> >     stDocName = "MilestoneDates"
> >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > ________________________________________
> > 
> > The type (Text), format (none specified), information (indexed, no 
> > duplicates) and even number of characters (255) is all the same between the 
> > DEVCODE field and the TrackingNo field.  They are in two different tables.
> > 
> > Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 5:24:09 PM
I don't see an issue - why don't you put a 
   debug.print stLinkCriteria
in each before the DoCmd statement, and see what it shows as you step 
through the code?

Is there anything different about the controls on the forms that hold the 
values?

-- 
Daryl S


"hntsignif" wrote:

> I have two forms.  Both have a button that call the same subform.
> 
> This is the information for the first call.  It works just fine.
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!DEVCODE & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> This is the information for the second call.  The Seasons portion works but 
> the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> then the other)
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!TrackingNo & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> The type (Text), format (none specified), information (indexed, no 
> duplicates) and even number of characters (255) is all the same between the 
> DEVCODE field and the TrackingNo field.  They are in two different tables.
> 
> Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 6:07:03 PM
No, no difference.  As a matter of fact the second form started out as a copy 
of the first form and I just changed the source to the new table and adjusted 
the fields and codes accordingly. 

I will give the debug idea a try.

"Daryl S" wrote:

> I don't see an issue - why don't you put a 
>    debug.print stLinkCriteria
> in each before the DoCmd statement, and see what it shows as you step 
> through the code?
> 
> Is there anything different about the controls on the forms that hold the 
> values?
> 
> -- 
> Daryl S
> 
> 
> "hntsignif" wrote:
> 
> > I have two forms.  Both have a button that call the same subform.
> > 
> > This is the information for the first call.  It works just fine.
> > ________________________________________
> >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > Me!DEVCODE & "'"
> >     stDocName = "MilestoneDates"
> >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > ________________________________________
> > 
> > This is the information for the second call.  The Seasons portion works but 
> > the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> > then the other)
> > ________________________________________
> >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > Me!TrackingNo & "'"
> >     stDocName = "MilestoneDates"
> >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > ________________________________________
> > 
> > The type (Text), format (none specified), information (indexed, no 
> > duplicates) and even number of characters (255) is all the same between the 
> > DEVCODE field and the TrackingNo field.  They are in two different tables.
> > 
> > Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 6:15:01 PM
What do you see with the debug.print statements?  (They will be in the 
immediate window when you run the code.)  They will show you what is being 
passed in - post the results for each here.
 
-- 
Daryl S


"hntsignif" wrote:

> No, no difference.  As a matter of fact the second form started out as a copy 
> of the first form and I just changed the source to the new table and adjusted 
> the fields and codes accordingly. 
> 
> I will give the debug idea a try.
> 
> "Daryl S" wrote:
> 
> > I don't see an issue - why don't you put a 
> >    debug.print stLinkCriteria
> > in each before the DoCmd statement, and see what it shows as you step 
> > through the code?
> > 
> > Is there anything different about the controls on the forms that hold the 
> > values?
> > 
> > -- 
> > Daryl S
> > 
> > 
> > "hntsignif" wrote:
> > 
> > > I have two forms.  Both have a button that call the same subform.
> > > 
> > > This is the information for the first call.  It works just fine.
> > > ________________________________________
> > >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > > Me!DEVCODE & "'"
> > >     stDocName = "MilestoneDates"
> > >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > > ________________________________________
> > > 
> > > This is the information for the second call.  The Seasons portion works but 
> > > the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> > > then the other)
> > > ________________________________________
> > >     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> > > Me!TrackingNo & "'"
> > >     stDocName = "MilestoneDates"
> > >     DoCmd.OpenForm stDocName, , , stLinkCriteria
> > > ________________________________________
> > > 
> > > The type (Text), format (none specified), information (indexed, no 
> > > duplicates) and even number of characters (255) is all the same between the 
> > > DEVCODE field and the TrackingNo field.  They are in two different tables.
> > > 
> > > Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 7:22:01 PM
Finally found the issue.  I hadn't added the second table to the called 
subform's SQL statement.

"hntsignif" wrote:

> I have two forms.  Both have a button that call the same subform.
> 
> This is the information for the first call.  It works just fine.
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!DEVCODE & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> This is the information for the second call.  The Seasons portion works but 
> the TrackingNo portion doesn't (Ie I pulled the code and ran one part and 
> then the other)
> ________________________________________
>     stLinkCriteria = "[SEASONS]='" & Me!Season & "' And [DevCodeA]='" & 
> Me!TrackingNo & "'"
>     stDocName = "MilestoneDates"
>     DoCmd.OpenForm stDocName, , , stLinkCriteria
> ________________________________________
> 
> The type (Text), format (none specified), information (indexed, no 
> duplicates) and even number of characters (255) is all the same between the 
> DEVCODE field and the TrackingNo field.  They are in two different tables.
> 
> Why would one work and not the other???  It is driving me nuts.
0
Utf
4/20/2010 10:45:01 PM
Reply:

Similar Artilces: