Too many controls in QBF

S

Steve

I tried finalizing my QBF by entering the applicable version of...
Forms![Form Name]![Control Name] OR Forms![Form Name]![Control Name] Is Null

....in the query field criteria row but Access 2000 freezes once I save the
query. I was attempting to use 10 combo boxes on a form, so the various OR
statements in the query were seemingly endless when I went back in via design
view. The original query is based on 6 different tables, and about 500,000
records are present when no criteria is set. In addition, Access would also
freeze when selecting criteria from the form and pressing the search command
button.

I should mention that in both instances, it was not immediately apparent
that Access was frozen. I came to this conclusion after waiting as much as 10
minutes for something to display. Ctrl-Alt-Delete and Access showed as Not
Responding.

Am I asking too much of the program or just going about it a bad way?
 
A

Allen Browne

The approach you are using is too inefficient for use with 500k records.

Dump the query. Instead, generate a SQL statement from only the boxes that
have a value, and assign it to the RecordSource of the search form.

The example below shows how to build the WHERE clause dynamically. Each case
tacks " AND " on the end ready for the next one, and the trailing " AND " is
chopped off at the end. This WHERE clause is then concatenated with the stub
(typically the SELECT clause) and the tail (typically the ORDER BY clause)
to form the complete SQL statement. After saving any edits in progress, this
string is then assigned to the RecordSource property of the form, so it
contains only records that match.

Don't forget that Text fields need quote delimiters around the literal
values, and date fields need the # delimiter. The example shows one of each,
but of course you can add as many as you need (theoretically up to 50
fields, or 99 in later versions of Access.)

If you have 500k records, you will want to do some tweaking to ensure this
is efficient:
1. You do not want to requery in the AfterUpdate event of each control, so I
assume you have a Search button to click to perform the search.

2. Make sure you have an index on any of the fields that will be used for
searching or sorting. (You mention a combo: if you have a relation to
another table, with referential integrity enforced, Access creates a hidden
index on the foreign key, so you do NOT index it manually as well.)

3. You probably want to initialize the form with no records, so you will
save it with the RecordSource set to a criteria that calculates for False
for all records, e.g.:
SELECT * FROM [Table1] WHERE (False) ORDER BY [SomeField];"

That should get you a search form that loads instantly, and shows search
results in a few seconds at most.

Example code for the Click event procedure of your cmdSearch command button:

Private Sub cmdSearch_Click()
Dim strSql As String
Dim lngLen As Long
Const strcStub = "SELECT * FROM [Table1]"
Const strcTail = " ORDER BY [SomeField];"
Const strcJetDate = "\#mm\/dd\/yyyy\#"

If Not IsNull(Me.cbo1) Then 'Number field example.
strSql = strSql & "([ID] = " & Me.cbo1 & ") AND "
End If

If Not IsNull(Me.cbo2) Then 'Text field example.
strSql = strSql & "([City] = """ & Me.cbo2 & """) AND "
End If

If Not IsNull(Me.txt3) Then 'Date field example
strSql = strSql & "([EventDate] = " & Format(Me.txt3, strcJetDate) &
") AND "
End If

lngLen = Len(strSql) - 5 'Without trailing " AND "
If lngLen > 0 Then
strSql = strcStub & " WHERE " & Left$(strSql, lngLen) & strcTail
Else
strSql = strcStub & strcTail
End If

If Me.Dirty Then 'Save First.
Me.Dirty = False
End If

'Assign the query string.
Me.RecordSource = strSql
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
I tried finalizing my QBF by entering the applicable version of...
Forms![Form Name]![Control Name] OR Forms![Form Name]![Control Name] Is
Null

...in the query field criteria row but Access 2000 freezes once I save the
query. I was attempting to use 10 combo boxes on a form, so the various OR
statements in the query were seemingly endless when I went back in via
design
view. The original query is based on 6 different tables, and about 500,000
records are present when no criteria is set. In addition, Access would
also
freeze when selecting criteria from the form and pressing the search
command
button.

I should mention that in both instances, it was not immediately apparent
that Access was frozen. I came to this conclusion after waiting as much as
10
minutes for something to display. Ctrl-Alt-Delete and Access showed as Not
Responding.

Am I asking too much of the program or just going about it a bad way?
 
S

Steve

Thank you for the post. Unfortunately, my Visual Basic knowledge is very poor
and I'm having a difficult time figuring out what to do.

Let me ask you about some lines of code:
SELECT * FROM [Table1] WHERE (False) ORDER BY [SomeField];"

I don't understand the "Table1" or "SomeField" reference because my basic
query uses several tables and has nearly 20 fields. What do I change these
references to?
Const strcStub = "SELECT * FROM [Table1]"
Const strcTail = " ORDER BY [SomeField];"

Again, what table and field am I referring to when several tables exist?
If Not IsNull(Me.cbo1) Then 'Number field example.
strSql = strSql & "([ID] = " & Me.cbo1 & ") AND "
End If

Do I replace cbo1, cbo2, etc. with the name of that combo box? In the above
example, what is ID, a field in Table1?

Thank you for the assistance.
 
A

Allen Browne

Yes, you have understood the basic idea correctly.
Answers in-line.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
Thank you for the post. Unfortunately, my Visual Basic knowledge is very
poor
and I'm having a difficult time figuring out what to do.

Let me ask you about some lines of code:
SELECT * FROM [Table1] WHERE (False) ORDER BY [SomeField];"

I don't understand the "Table1" or "SomeField" reference because my basic
query uses several tables and has nearly 20 fields. What do I change these
references to?
Const strcStub = "SELECT * FROM [Table1]"
Const strcTail = " ORDER BY [SomeField];"

If you already have a query that gives you essentially what you need, then
open the query and switch it to SQL View (View menu.) The query is made of
of a SELECT clause, a FROM clause, a WHERE clause, and probably an ORDER BY
clause, and possibly others such as ORDER BY. You need to build the WHERE
clause dynmically.

Everything before "WHERE" goes into the strcStub line. (The stub is
typically the SELECT and FROM clauses.) Everything after the (perhaps
lenghty) WHERE clause goes into the strcTail. (The tail typically starst
with "ORDER BY".) Post your entire SQL statement if you are not sure how to
pull the WHERE clause out of it.
Again, what table and field am I referring to when several tables exist?

The FROM clause will contain several tables, complete with "INNER JOIN ON
...." between them.
If Not IsNull(Me.cbo1) Then 'Number field example.
strSql = strSql & "([ID] = " & Me.cbo1 & ") AND "
End If

Do I replace cbo1, cbo2, etc. with the name of that combo box? In the
above
example, what is ID, a field in Table1?

Yes, cbo1 is an example of the name of your first combo box, which is
assumed to be matching a field named ID. If your combo box was named Combo2,
and your field was called EventID, you would use:
If Not IsNull(Me.Combo2) Then
strSql = strSql & "([EventID] = " & Me.Combo2 & ") AND "
End If
Thank you for the assistance.

Go ahead and give that a shot. If it turns out that you do have lots of
tables in this query statement, that may also be a contributing factor to
the slowness of the form, so (as always) keep it as simple as practical for
your purposes.
 
S

Steve

Allen,

While I very much appreciate your help, I am extremely lost. Trying to make
this work reminded me why I never pursued VB over the years.

The most basic query to get all information that I need together and in one
place looks like this is SQL View:

SELECT [Reporting Marks].Initials, Master.Number, Master.[L/E], [STCC
used].[Commodity Description], Master.Tons, IIf([Customer 633.Name] Is
Null,"**" & [Customer 633.633],[Customer 633.Name]) AS Consignee,
IIf([Customer 633_1.Name] Is Null,"**" & [Customer 633_1.633],[Customer
633_1.Name]) AS Shipper, [Stations 333_1].[Station Name], [Stations
333_2].[Station Name], [Stations 333_3].[Station Name], [Stations
333_4].[Station Name], Contents.Contents, [Stations 333].[Station Name],
[Reporting Marks_1].Initials, Master.[Waybill Date], Master.Waybill,
Symbols.[Train Symbol], [SCHI Definitions].Description, [SCHI
Definitions_1].Description, [SCHI Definitions_2].Description, [SCHI
Definitions_3].Description, [SCHI Definitions_4].Description, [SCHI
Definitions_5].Description
FROM Symbols INNER JOIN ([STCC used] RIGHT JOIN ([Stations 333] AS [Stations
333_4] INNER JOIN (([SCHI Definitions] RIGHT JOIN ([SCHI Definitions] AS
[SCHI Definitions_3] RIGHT JOIN ([SCHI Definitions] AS [SCHI Definitions_4]
RIGHT JOIN ([SCHI Definitions] AS [SCHI Definitions_5] RIGHT JOIN ([SCHI
Definitions] AS [SCHI Definitions_2] RIGHT JOIN ([SCHI Definitions] AS [SCHI
Definitions_1] RIGHT JOIN SCHI ON [SCHI Definitions_1].SCHI1 = SCHI.SCHI2) ON
[SCHI Definitions_2].SCHI1 = SCHI.SCHI3) ON [SCHI Definitions_5].SCHI1 =
SCHI.SCHI6) ON [SCHI Definitions_4].SCHI1 = SCHI.SCHI5) ON [SCHI
Definitions_3].SCHI1 = SCHI.SCHI4) ON [SCHI Definitions].SCHI1 = SCHI.SCHI1)
RIGHT JOIN ([Reporting Marks] INNER JOIN (([Customer 633] AS [Customer 633_1]
INNER JOIN (Contents RIGHT JOIN ([Reporting Marks] AS [Reporting Marks_1]
RIGHT JOIN ([Customer 633] INNER JOIN ([Stations 333] AS [Stations 333_2]
INNER JOIN ([Stations 333] INNER JOIN ([Stations 333] AS [Stations 333_1]
INNER JOIN Master ON [Stations 333_1].StationID = Master.OriginID) ON
[Stations 333].StationID = Master.OperStatID) ON [Stations 333_2].StationID =
Master.DestID) ON [Customer 633].CustID = Master.ConsigneeID) ON [Reporting
Marks_1].InitialsID = Master.RAJP_ID) ON Contents.ContentsID =
Master.ContentsID) ON [Customer 633_1].CustID = Master.ShipperID) INNER JOIN
([Stations 333] AS [Stations 333_3] INNER JOIN From_To_Symbols ON [Stations
333_3].StationID = From_To_Symbols.FromID) ON Master.[Record Num] =
From_To_Symbols.[Record Number]) ON [Reporting Marks].InitialsID =
Master.InitialsCode) ON SCHI.SCHI_ID = Master.SCHI_ID) ON [Stations
333_4].StationID = From_To_Symbols.ToID) ON [STCC used].STCC = Master.STCC)
ON Symbols.SymbolID = From_To_Symbols.[Symbol ID]
ORDER BY [Reporting Marks].Initials, Master.Number;

As you can see, this is a complete nightmare. I am not sure where anything
goes in the SQL statement you provided for me earlier. I appreciate your
help.
 
A

Allen Browne

The WHERE clause goes after the FROM clause, and before the ORDER BY clause.

That means everything except the last line goes into the strcStub string.
The last line goes into the strcTail string, with a leading space, i.e.:
Const strcTail = " ORDER BY [Reporting Marks].Initials, Master.Number;"

The line endings in the SQL string are not significant, but you may have too
many characters to fit on one line. If so, you use the line continuation
technique, consisting of an ampersand, space and underscore. Example:
Const strcStub = "This is a long line" & _
" that includes the characters on this physical line too."
Don't forget to include the space between the words when you do this.

There are a couple of places where you have the double-quote character in
your string. VBA gets confused when it comes to this character, as it things
it is the closing quote and has no idea what to do with the rest of the
line. The convention is to double up the quote characters when they are
embedded. So if you want:
This string has a "word" in quotes.
you have to code:
strcStub = "This string has a ""word"" in quotes."

You will therefore use:
strcStub = "SELECT ... IIf([Customer 633.Name] Is Null, ""**"" & ...

Once you have the 2 strings right, you can proceed to building the WHERE
clause to stick between them.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
Allen,

While I very much appreciate your help, I am extremely lost. Trying to
make
this work reminded me why I never pursued VB over the years.

The most basic query to get all information that I need together and in
one
place looks like this is SQL View:

SELECT [Reporting Marks].Initials, Master.Number, Master.[L/E], [STCC
used].[Commodity Description], Master.Tons, IIf([Customer 633.Name] Is
Null,"**" & [Customer 633.633],[Customer 633.Name]) AS Consignee,
IIf([Customer 633_1.Name] Is Null,"**" & [Customer 633_1.633],[Customer
633_1.Name]) AS Shipper, [Stations 333_1].[Station Name], [Stations
333_2].[Station Name], [Stations 333_3].[Station Name], [Stations
333_4].[Station Name], Contents.Contents, [Stations 333].[Station Name],
[Reporting Marks_1].Initials, Master.[Waybill Date], Master.Waybill,
Symbols.[Train Symbol], [SCHI Definitions].Description, [SCHI
Definitions_1].Description, [SCHI Definitions_2].Description, [SCHI
Definitions_3].Description, [SCHI Definitions_4].Description, [SCHI
Definitions_5].Description
FROM Symbols INNER JOIN ([STCC used] RIGHT JOIN ([Stations 333] AS
[Stations
333_4] INNER JOIN (([SCHI Definitions] RIGHT JOIN ([SCHI Definitions] AS
[SCHI Definitions_3] RIGHT JOIN ([SCHI Definitions] AS [SCHI
Definitions_4]
RIGHT JOIN ([SCHI Definitions] AS [SCHI Definitions_5] RIGHT JOIN ([SCHI
Definitions] AS [SCHI Definitions_2] RIGHT JOIN ([SCHI Definitions] AS
[SCHI
Definitions_1] RIGHT JOIN SCHI ON [SCHI Definitions_1].SCHI1 = SCHI.SCHI2)
ON
[SCHI Definitions_2].SCHI1 = SCHI.SCHI3) ON [SCHI Definitions_5].SCHI1 =
SCHI.SCHI6) ON [SCHI Definitions_4].SCHI1 = SCHI.SCHI5) ON [SCHI
Definitions_3].SCHI1 = SCHI.SCHI4) ON [SCHI Definitions].SCHI1 =
SCHI.SCHI1)
RIGHT JOIN ([Reporting Marks] INNER JOIN (([Customer 633] AS [Customer
633_1]
INNER JOIN (Contents RIGHT JOIN ([Reporting Marks] AS [Reporting Marks_1]
RIGHT JOIN ([Customer 633] INNER JOIN ([Stations 333] AS [Stations 333_2]
INNER JOIN ([Stations 333] INNER JOIN ([Stations 333] AS [Stations 333_1]
INNER JOIN Master ON [Stations 333_1].StationID = Master.OriginID) ON
[Stations 333].StationID = Master.OperStatID) ON [Stations
333_2].StationID =
Master.DestID) ON [Customer 633].CustID = Master.ConsigneeID) ON
[Reporting
Marks_1].InitialsID = Master.RAJP_ID) ON Contents.ContentsID =
Master.ContentsID) ON [Customer 633_1].CustID = Master.ShipperID) INNER
JOIN
([Stations 333] AS [Stations 333_3] INNER JOIN From_To_Symbols ON
[Stations
333_3].StationID = From_To_Symbols.FromID) ON Master.[Record Num] =
From_To_Symbols.[Record Number]) ON [Reporting Marks].InitialsID =
Master.InitialsCode) ON SCHI.SCHI_ID = Master.SCHI_ID) ON [Stations
333_4].StationID = From_To_Symbols.ToID) ON [STCC used].STCC =
Master.STCC)
ON Symbols.SymbolID = From_To_Symbols.[Symbol ID]
ORDER BY [Reporting Marks].Initials, Master.Number;

As you can see, this is a complete nightmare. I am not sure where anything
goes in the SQL statement you provided for me earlier. I appreciate your
help.
 
S

Steve

Please do not take this personally, but I just do not understand what you're
saying. Remember, my knowledge of SQL and VBA is virtually zilch. This is why
I took the macro approach to begin with, I just wish it worked more
effectively.

I have spent a total of 7 hours now trying to implement your suggestion
without any success. I simply cannot afford to spend any more time doing
this. Again, this is not a flame against you, for I am very grateful for your
help.

I would gladly pay someone to finish this for me if the price were right. If
you know of a place where I could get this done, please advise.

Thank you again for your trouble, and I apologize it didn't work out.

Steve

Allen Browne said:
The WHERE clause goes after the FROM clause, and before the ORDER BY clause.

That means everything except the last line goes into the strcStub string.
The last line goes into the strcTail string, with a leading space, i.e.:
Const strcTail = " ORDER BY [Reporting Marks].Initials, Master.Number;"

The line endings in the SQL string are not significant, but you may have too
many characters to fit on one line. If so, you use the line continuation
technique, consisting of an ampersand, space and underscore. Example:
Const strcStub = "This is a long line" & _
" that includes the characters on this physical line too."
Don't forget to include the space between the words when you do this.

There are a couple of places where you have the double-quote character in
your string. VBA gets confused when it comes to this character, as it things
it is the closing quote and has no idea what to do with the rest of the
line. The convention is to double up the quote characters when they are
embedded. So if you want:
This string has a "word" in quotes.
you have to code:
strcStub = "This string has a ""word"" in quotes."

You will therefore use:
strcStub = "SELECT ... IIf([Customer 633.Name] Is Null, ""**"" & ...

Once you have the 2 strings right, you can proceed to building the WHERE
clause to stick between them.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
Allen,

While I very much appreciate your help, I am extremely lost. Trying to
make
this work reminded me why I never pursued VB over the years.

The most basic query to get all information that I need together and in
one
place looks like this is SQL View:

SELECT [Reporting Marks].Initials, Master.Number, Master.[L/E], [STCC
used].[Commodity Description], Master.Tons, IIf([Customer 633.Name] Is
Null,"**" & [Customer 633.633],[Customer 633.Name]) AS Consignee,
IIf([Customer 633_1.Name] Is Null,"**" & [Customer 633_1.633],[Customer
633_1.Name]) AS Shipper, [Stations 333_1].[Station Name], [Stations
333_2].[Station Name], [Stations 333_3].[Station Name], [Stations
333_4].[Station Name], Contents.Contents, [Stations 333].[Station Name],
[Reporting Marks_1].Initials, Master.[Waybill Date], Master.Waybill,
Symbols.[Train Symbol], [SCHI Definitions].Description, [SCHI
Definitions_1].Description, [SCHI Definitions_2].Description, [SCHI
Definitions_3].Description, [SCHI Definitions_4].Description, [SCHI
Definitions_5].Description
FROM Symbols INNER JOIN ([STCC used] RIGHT JOIN ([Stations 333] AS
[Stations
333_4] INNER JOIN (([SCHI Definitions] RIGHT JOIN ([SCHI Definitions] AS
[SCHI Definitions_3] RIGHT JOIN ([SCHI Definitions] AS [SCHI
Definitions_4]
RIGHT JOIN ([SCHI Definitions] AS [SCHI Definitions_5] RIGHT JOIN ([SCHI
Definitions] AS [SCHI Definitions_2] RIGHT JOIN ([SCHI Definitions] AS
[SCHI
Definitions_1] RIGHT JOIN SCHI ON [SCHI Definitions_1].SCHI1 = SCHI.SCHI2)
ON
[SCHI Definitions_2].SCHI1 = SCHI.SCHI3) ON [SCHI Definitions_5].SCHI1 =
SCHI.SCHI6) ON [SCHI Definitions_4].SCHI1 = SCHI.SCHI5) ON [SCHI
Definitions_3].SCHI1 = SCHI.SCHI4) ON [SCHI Definitions].SCHI1 =
SCHI.SCHI1)
RIGHT JOIN ([Reporting Marks] INNER JOIN (([Customer 633] AS [Customer
633_1]
INNER JOIN (Contents RIGHT JOIN ([Reporting Marks] AS [Reporting Marks_1]
RIGHT JOIN ([Customer 633] INNER JOIN ([Stations 333] AS [Stations 333_2]
INNER JOIN ([Stations 333] INNER JOIN ([Stations 333] AS [Stations 333_1]
INNER JOIN Master ON [Stations 333_1].StationID = Master.OriginID) ON
[Stations 333].StationID = Master.OperStatID) ON [Stations
333_2].StationID =
Master.DestID) ON [Customer 633].CustID = Master.ConsigneeID) ON
[Reporting
Marks_1].InitialsID = Master.RAJP_ID) ON Contents.ContentsID =
Master.ContentsID) ON [Customer 633_1].CustID = Master.ShipperID) INNER
JOIN
([Stations 333] AS [Stations 333_3] INNER JOIN From_To_Symbols ON
[Stations
333_3].StationID = From_To_Symbols.FromID) ON Master.[Record Num] =
From_To_Symbols.[Record Number]) ON [Reporting Marks].InitialsID =
Master.InitialsCode) ON SCHI.SCHI_ID = Master.SCHI_ID) ON [Stations
333_4].StationID = From_To_Symbols.ToID) ON [STCC used].STCC =
Master.STCC)
ON Symbols.SymbolID = From_To_Symbols.[Symbol ID]
ORDER BY [Reporting Marks].Initials, Master.Number;

As you can see, this is a complete nightmare. I am not sure where anything
goes in the SQL statement you provided for me earlier. I appreciate your
help.
 
A

Allen Browne

Hi Steve

If you are still stuck, email me. You can figure out the address from the
signature below (which is munged to avoid the spambots.) Include the text
from this thread in the email.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
Please do not take this personally, but I just do not understand what
you're
saying. Remember, my knowledge of SQL and VBA is virtually zilch. This is
why
I took the macro approach to begin with, I just wish it worked more
effectively.

I have spent a total of 7 hours now trying to implement your suggestion
without any success. I simply cannot afford to spend any more time doing
this. Again, this is not a flame against you, for I am very grateful for
your
help.

I would gladly pay someone to finish this for me if the price were right.
If
you know of a place where I could get this done, please advise.

Thank you again for your trouble, and I apologize it didn't work out.

Steve

Allen Browne said:
The WHERE clause goes after the FROM clause, and before the ORDER BY
clause.

That means everything except the last line goes into the strcStub string.
The last line goes into the strcTail string, with a leading space, i.e.:
Const strcTail = " ORDER BY [Reporting Marks].Initials,
Master.Number;"

The line endings in the SQL string are not significant, but you may have
too
many characters to fit on one line. If so, you use the line continuation
technique, consisting of an ampersand, space and underscore. Example:
Const strcStub = "This is a long line" & _
" that includes the characters on this physical line too."
Don't forget to include the space between the words when you do this.

There are a couple of places where you have the double-quote character in
your string. VBA gets confused when it comes to this character, as it
things
it is the closing quote and has no idea what to do with the rest of the
line. The convention is to double up the quote characters when they are
embedded. So if you want:
This string has a "word" in quotes.
you have to code:
strcStub = "This string has a ""word"" in quotes."

You will therefore use:
strcStub = "SELECT ... IIf([Customer 633.Name] Is Null, ""**"" & ...

Once you have the 2 strings right, you can proceed to building the WHERE
clause to stick between them.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Steve said:
Allen,

While I very much appreciate your help, I am extremely lost. Trying to
make
this work reminded me why I never pursued VB over the years.

The most basic query to get all information that I need together and in
one
place looks like this is SQL View:

SELECT [Reporting Marks].Initials, Master.Number, Master.[L/E], [STCC
used].[Commodity Description], Master.Tons, IIf([Customer 633.Name] Is
Null,"**" & [Customer 633.633],[Customer 633.Name]) AS Consignee,
IIf([Customer 633_1.Name] Is Null,"**" & [Customer 633_1.633],[Customer
633_1.Name]) AS Shipper, [Stations 333_1].[Station Name], [Stations
333_2].[Station Name], [Stations 333_3].[Station Name], [Stations
333_4].[Station Name], Contents.Contents, [Stations 333].[Station
Name],
[Reporting Marks_1].Initials, Master.[Waybill Date], Master.Waybill,
Symbols.[Train Symbol], [SCHI Definitions].Description, [SCHI
Definitions_1].Description, [SCHI Definitions_2].Description, [SCHI
Definitions_3].Description, [SCHI Definitions_4].Description, [SCHI
Definitions_5].Description
FROM Symbols INNER JOIN ([STCC used] RIGHT JOIN ([Stations 333] AS
[Stations
333_4] INNER JOIN (([SCHI Definitions] RIGHT JOIN ([SCHI Definitions]
AS
[SCHI Definitions_3] RIGHT JOIN ([SCHI Definitions] AS [SCHI
Definitions_4]
RIGHT JOIN ([SCHI Definitions] AS [SCHI Definitions_5] RIGHT JOIN
([SCHI
Definitions] AS [SCHI Definitions_2] RIGHT JOIN ([SCHI Definitions] AS
[SCHI
Definitions_1] RIGHT JOIN SCHI ON [SCHI Definitions_1].SCHI1 =
SCHI.SCHI2)
ON
[SCHI Definitions_2].SCHI1 = SCHI.SCHI3) ON [SCHI Definitions_5].SCHI1
=
SCHI.SCHI6) ON [SCHI Definitions_4].SCHI1 = SCHI.SCHI5) ON [SCHI
Definitions_3].SCHI1 = SCHI.SCHI4) ON [SCHI Definitions].SCHI1 =
SCHI.SCHI1)
RIGHT JOIN ([Reporting Marks] INNER JOIN (([Customer 633] AS [Customer
633_1]
INNER JOIN (Contents RIGHT JOIN ([Reporting Marks] AS [Reporting
Marks_1]
RIGHT JOIN ([Customer 633] INNER JOIN ([Stations 333] AS [Stations
333_2]
INNER JOIN ([Stations 333] INNER JOIN ([Stations 333] AS [Stations
333_1]
INNER JOIN Master ON [Stations 333_1].StationID = Master.OriginID) ON
[Stations 333].StationID = Master.OperStatID) ON [Stations
333_2].StationID =
Master.DestID) ON [Customer 633].CustID = Master.ConsigneeID) ON
[Reporting
Marks_1].InitialsID = Master.RAJP_ID) ON Contents.ContentsID =
Master.ContentsID) ON [Customer 633_1].CustID = Master.ShipperID) INNER
JOIN
([Stations 333] AS [Stations 333_3] INNER JOIN From_To_Symbols ON
[Stations
333_3].StationID = From_To_Symbols.FromID) ON Master.[Record Num] =
From_To_Symbols.[Record Number]) ON [Reporting Marks].InitialsID =
Master.InitialsCode) ON SCHI.SCHI_ID = Master.SCHI_ID) ON [Stations
333_4].StationID = From_To_Symbols.ToID) ON [STCC used].STCC =
Master.STCC)
ON Symbols.SymbolID = From_To_Symbols.[Symbol ID]
ORDER BY [Reporting Marks].Initials, Master.Number;

As you can see, this is a complete nightmare. I am not sure where
anything
goes in the SQL statement you provided for me earlier. I appreciate
your
help.
 

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