Prev: IIf statement sometimes works
Next: Data Refresh
From: hntsignif on 20 Apr 2010 12:52 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.
From: Danny on 20 Apr 2010 12:59 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.
From: hntsignif on 20 Apr 2010 13:24 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.
From: Daryl S on 20 Apr 2010 14:07 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.
From: hntsignif on 20 Apr 2010 14:15
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. |