Home All Groups Group Topic Archive Search About
Author
6 Dec 2006 8:10 PM
Cameron
can you apply a Order By clause to a Inner Join? When I do this I get an
invaild Argument error.

Author
6 Dec 2006 8:12 PM
Lynn Trapp
Yes you can. Would you post your SQL?

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> can you apply a Order By clause to a Inner Join? When I do this I get an
> invaild Argument error.
Author
6 Dec 2006 8:19 PM
Cameron
SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors Master
Table].ConNum, CompanyName
FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
[contractors Master Table].ConNum = [Company Master Table].ConNum
WHERE ([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID] OR
[Forms]![main menu]![CompanyID] Is Null) And
            ([contractors Master Table].Active=Yes)
ORDER BY [Last] & ", " & [First];



Show quoteHide quote
"Lynn Trapp" wrote:

> Yes you can. Would you post your SQL?
>
> --
>
> Lynn Trapp
> Microsoft MVP (Access)
> www.ltcomputerdesigns.com
>
>
> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> > can you apply a Order By clause to a Inner Join? When I do this I get an
> > invaild Argument error.
>
>
>
Author
6 Dec 2006 8:29 PM
Lynn Trapp
Try changing the Order By clause to simply:

ORDER BY [Last], [First]

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors Master
> Table].ConNum, CompanyName
> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> [contractors Master Table].ConNum = [Company Master Table].ConNum
> WHERE ([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID]
> OR
> [Forms]![main menu]![CompanyID] Is Null) And
>            ([contractors Master Table].Active=Yes)
> ORDER BY [Last] & ", " & [First];
>
>
>
> "Lynn Trapp" wrote:
>
>> Yes you can. Would you post your SQL?
>>
>> --
>>
>> Lynn Trapp
>> Microsoft MVP (Access)
>> www.ltcomputerdesigns.com
>>
>>
>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>> > can you apply a Order By clause to a Inner Join? When I do this I get
>> > an
>> > invaild Argument error.
>>
>>
>>
Author
6 Dec 2006 8:39 PM
Cameron
I tried that and I still get an invalid argument error.

Show quoteHide quote
"Lynn Trapp" wrote:

> Try changing the Order By clause to simply:
>
> ORDER BY [Last], [First]
>
> --
>
> Lynn Trapp
> Microsoft MVP (Access)
> www.ltcomputerdesigns.com
>
>
> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> > SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors Master
> > Table].ConNum, CompanyName
> > FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> > [contractors Master Table].ConNum = [Company Master Table].ConNum
> > WHERE ([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID]
> > OR
> > [Forms]![main menu]![CompanyID] Is Null) And
> >            ([contractors Master Table].Active=Yes)
> > ORDER BY [Last] & ", " & [First];
> >
> >
> >
> > "Lynn Trapp" wrote:
> >
> >> Yes you can. Would you post your SQL?
> >>
> >> --
> >>
> >> Lynn Trapp
> >> Microsoft MVP (Access)
> >> www.ltcomputerdesigns.com
> >>
> >>
> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> >> > can you apply a Order By clause to a Inner Join? When I do this I get
> >> > an
> >> > invaild Argument error.
> >>
> >>
> >>
>
>
>
Author
6 Dec 2006 8:47 PM
Lynn Trapp
So are [Last] and [First] fields in [contractors Master Table]?

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:BE7BE1C1-6B32-4C50-ADFD-DCA838F9EB81@microsoft.com...
>I tried that and I still get an invalid argument error.
>
> "Lynn Trapp" wrote:
>
>> Try changing the Order By clause to simply:
>>
>> ORDER BY [Last], [First]
>>
>> --
>>
>> Lynn Trapp
>> Microsoft MVP (Access)
>> www.ltcomputerdesigns.com
>>
>>
>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
>> > SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
>> > Master
>> > Table].ConNum, CompanyName
>> > FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>> > [contractors Master Table].ConNum = [Company Master Table].ConNum
>> > WHERE ([contractors Master Table].ConNum=[Forms]![main
>> > menu]![CompanyID]
>> > OR
>> > [Forms]![main menu]![CompanyID] Is Null) And
>> >            ([contractors Master Table].Active=Yes)
>> > ORDER BY [Last] & ", " & [First];
>> >
>> >
>> >
>> > "Lynn Trapp" wrote:
>> >
>> >> Yes you can. Would you post your SQL?
>> >>
>> >> --
>> >>
>> >> Lynn Trapp
>> >> Microsoft MVP (Access)
>> >> www.ltcomputerdesigns.com
>> >>
>> >>
>> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>> >> > can you apply a Order By clause to a Inner Join? When I do this I
>> >> > get
>> >> > an
>> >> > invaild Argument error.
>> >>
>> >>
>> >>
>>
>>
>>
Author
6 Dec 2006 8:48 PM
Lynn Trapp
oops... i think I see it. Change your WHERE clause:

WHERE ([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID]
OR IsNull([Forms]![main menu]![CompanyID]))

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:BE7BE1C1-6B32-4C50-ADFD-DCA838F9EB81@microsoft.com...
>I tried that and I still get an invalid argument error.
>
> "Lynn Trapp" wrote:
>
>> Try changing the Order By clause to simply:
>>
>> ORDER BY [Last], [First]
>>
>> --
>>
>> Lynn Trapp
>> Microsoft MVP (Access)
>> www.ltcomputerdesigns.com
>>
>>
>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
>> > SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
>> > Master
>> > Table].ConNum, CompanyName
>> > FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>> > [contractors Master Table].ConNum = [Company Master Table].ConNum
>> > WHERE ([contractors Master Table].ConNum=[Forms]![main
>> > menu]![CompanyID]
>> > OR
>> > [Forms]![main menu]![CompanyID] Is Null) And
>> >            ([contractors Master Table].Active=Yes)
>> > ORDER BY [Last] & ", " & [First];
>> >
>> >
>> >
>> > "Lynn Trapp" wrote:
>> >
>> >> Yes you can. Would you post your SQL?
>> >>
>> >> --
>> >>
>> >> Lynn Trapp
>> >> Microsoft MVP (Access)
>> >> www.ltcomputerdesigns.com
>> >>
>> >>
>> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>> >> > can you apply a Order By clause to a Inner Join? When I do this I
>> >> > get
>> >> > an
>> >> > invaild Argument error.
>> >>
>> >>
>> >>
>>
>>
>>
Author
6 Dec 2006 9:56 PM
Cameron
Ok, I tried this one too. And it came up as an invalid argument error.

Show quoteHide quote
"Lynn Trapp" wrote:

> oops... i think I see it. Change your WHERE clause:
>
> WHERE ([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID]
> OR IsNull([Forms]![main menu]![CompanyID]))
>
> --
>
> Lynn Trapp
> Microsoft MVP (Access)
> www.ltcomputerdesigns.com
>
>
> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> news:BE7BE1C1-6B32-4C50-ADFD-DCA838F9EB81@microsoft.com...
> >I tried that and I still get an invalid argument error.
> >
> > "Lynn Trapp" wrote:
> >
> >> Try changing the Order By clause to simply:
> >>
> >> ORDER BY [Last], [First]
> >>
> >> --
> >>
> >> Lynn Trapp
> >> Microsoft MVP (Access)
> >> www.ltcomputerdesigns.com
> >>
> >>
> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> >> > SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
> >> > Master
> >> > Table].ConNum, CompanyName
> >> > FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> >> > [contractors Master Table].ConNum = [Company Master Table].ConNum
> >> > WHERE ([contractors Master Table].ConNum=[Forms]![main
> >> > menu]![CompanyID]
> >> > OR
> >> > [Forms]![main menu]![CompanyID] Is Null) And
> >> >            ([contractors Master Table].Active=Yes)
> >> > ORDER BY [Last] & ", " & [First];
> >> >
> >> >
> >> >
> >> > "Lynn Trapp" wrote:
> >> >
> >> >> Yes you can. Would you post your SQL?
> >> >>
> >> >> --
> >> >>
> >> >> Lynn Trapp
> >> >> Microsoft MVP (Access)
> >> >> www.ltcomputerdesigns.com
> >> >>
> >> >>
> >> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> >> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> >> >> > can you apply a Order By clause to a Inner Join? When I do this I
> >> >> > get
> >> >> > an
> >> >> > invaild Argument error.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Author
6 Dec 2006 9:17 PM
Joan Wild
Are you building this SQL statement in code, or is this the SQL of a saved
query?

Try providing the table name for each field...
SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS LastFirst,
[contractors Master Table].ConNum, [Company Master Table].[Company Name]
FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
[contractors Master Table].ConNum = [Company Master Table].ConNum

Also you may need to make clear your WHERE statement with some more brackets
WHERE ((([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID])
OR
([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
Table].Active=Yes))
ORDER BY [Last] & ", " & [First];

You may also be having the problem because you are using Last and First as
field names, both of which are reserved words in Access.
--
Joan Wild
Microsoft Access MVP

Cameron wrote:
Show quoteHide quote
> I tried that and I still get an invalid argument error.
>
> "Lynn Trapp" wrote:
>
>> Try changing the Order By clause to simply:
>>
>> ORDER BY [Last], [First]
>>
>> --
>>
>> Lynn Trapp
>> Microsoft MVP (Access)
>> www.ltcomputerdesigns.com
>>
>>
>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
>>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
>>> Master Table].ConNum, CompanyName
>>> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>>> [contractors Master Table].ConNum = [Company Master Table].ConNum
>>> WHERE ([contractors Master Table].ConNum=[Forms]![main
>>> menu]![CompanyID] OR
>>> [Forms]![main menu]![CompanyID] Is Null) And
>>>            ([contractors Master Table].Active=Yes)
>>> ORDER BY [Last] & ", " & [First];
>>>
>>>
>>>
>>> "Lynn Trapp" wrote:
>>>
>>>> Yes you can. Would you post your SQL?
>>>>
>>>> --
>>>>
>>>> Lynn Trapp
>>>> Microsoft MVP (Access)
>>>> www.ltcomputerdesigns.com
>>>>
>>>>
>>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>>>>> can you apply a Order By clause to a Inner Join? When I do this I
>>>>> get an
>>>>> invaild Argument error.
Author
6 Dec 2006 9:57 PM
Cameron
It is in a saved query. And I have tried to put in the table names on the
respective fields. Still got the error

Show quoteHide quote
"Joan Wild" wrote:

> Are you building this SQL statement in code, or is this the SQL of a saved
> query?
>
> Try providing the table name for each field...
> SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS LastFirst,
> [contractors Master Table].ConNum, [Company Master Table].[Company Name]
> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> [contractors Master Table].ConNum = [Company Master Table].ConNum
>
> Also you may need to make clear your WHERE statement with some more brackets
> WHERE ((([contractors Master Table].ConNum=[Forms]![main menu]![CompanyID])
> OR
> ([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
> Table].Active=Yes))
> ORDER BY [Last] & ", " & [First];
>
> You may also be having the problem because you are using Last and First as
> field names, both of which are reserved words in Access.
> --
> Joan Wild
> Microsoft Access MVP
>
> Cameron wrote:
> > I tried that and I still get an invalid argument error.
> >
> > "Lynn Trapp" wrote:
> >
> >> Try changing the Order By clause to simply:
> >>
> >> ORDER BY [Last], [First]
> >>
> >> --
> >>
> >> Lynn Trapp
> >> Microsoft MVP (Access)
> >> www.ltcomputerdesigns.com
> >>
> >>
> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> >>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
> >>> Master Table].ConNum, CompanyName
> >>> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> >>> [contractors Master Table].ConNum = [Company Master Table].ConNum
> >>> WHERE ([contractors Master Table].ConNum=[Forms]![main
> >>> menu]![CompanyID] OR
> >>> [Forms]![main menu]![CompanyID] Is Null) And
> >>>            ([contractors Master Table].Active=Yes)
> >>> ORDER BY [Last] & ", " & [First];
> >>>
> >>>
> >>>
> >>> "Lynn Trapp" wrote:
> >>>
> >>>> Yes you can. Would you post your SQL?
> >>>>
> >>>> --
> >>>>
> >>>> Lynn Trapp
> >>>> Microsoft MVP (Access)
> >>>> www.ltcomputerdesigns.com
> >>>>
> >>>>
> >>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> >>>>> can you apply a Order By clause to a Inner Join? When I do this I
> >>>>> get an
> >>>>> invaild Argument error.
>
>
>
Author
6 Dec 2006 10:19 PM
Lynn Trapp
Cameron,
Joan may be on to something here. Are [Last] and [First] field names in your
table?

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:C9038F10-A77B-4412-B266-FFEBECA3EBC0@microsoft.com...
> It is in a saved query. And I have tried to put in the table names on the
> respective fields. Still got the error
>
> "Joan Wild" wrote:
>
>> Are you building this SQL statement in code, or is this the SQL of a
>> saved
>> query?
>>
>> Try providing the table name for each field...
>> SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS
>> LastFirst,
>> [contractors Master Table].ConNum, [Company Master Table].[Company Name]
>> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>> [contractors Master Table].ConNum = [Company Master Table].ConNum
>>
>> Also you may need to make clear your WHERE statement with some more
>> brackets
>> WHERE ((([contractors Master Table].ConNum=[Forms]![main
>> menu]![CompanyID])
>> OR
>> ([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
>> Table].Active=Yes))
>> ORDER BY [Last] & ", " & [First];
>>
>> You may also be having the problem because you are using Last and First
>> as
>> field names, both of which are reserved words in Access.
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Cameron wrote:
>> > I tried that and I still get an invalid argument error.
>> >
>> > "Lynn Trapp" wrote:
>> >
>> >> Try changing the Order By clause to simply:
>> >>
>> >> ORDER BY [Last], [First]
>> >>
>> >> --
>> >>
>> >> Lynn Trapp
>> >> Microsoft MVP (Access)
>> >> www.ltcomputerdesigns.com
>> >>
>> >>
>> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
>> >>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
>> >>> Master Table].ConNum, CompanyName
>> >>> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>> >>> [contractors Master Table].ConNum = [Company Master Table].ConNum
>> >>> WHERE ([contractors Master Table].ConNum=[Forms]![main
>> >>> menu]![CompanyID] OR
>> >>> [Forms]![main menu]![CompanyID] Is Null) And
>> >>>            ([contractors Master Table].Active=Yes)
>> >>> ORDER BY [Last] & ", " & [First];
>> >>>
>> >>>
>> >>>
>> >>> "Lynn Trapp" wrote:
>> >>>
>> >>>> Yes you can. Would you post your SQL?
>> >>>>
>> >>>> --
>> >>>>
>> >>>> Lynn Trapp
>> >>>> Microsoft MVP (Access)
>> >>>> www.ltcomputerdesigns.com
>> >>>>
>> >>>>
>> >>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>> >>>>> can you apply a Order By clause to a Inner Join? When I do this I
>> >>>>> get an
>> >>>>> invaild Argument error.
>>
>>
>>
Author
6 Dec 2006 10:24 PM
Cameron
Yes, they are.

Show quoteHide quote
"Lynn Trapp" wrote:

> Cameron,
> Joan may be on to something here. Are [Last] and [First] field names in your
> table?
>
> --
>
> Lynn Trapp
> Microsoft MVP (Access)
> www.ltcomputerdesigns.com
>
>
> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> news:C9038F10-A77B-4412-B266-FFEBECA3EBC0@microsoft.com...
> > It is in a saved query. And I have tried to put in the table names on the
> > respective fields. Still got the error
> >
> > "Joan Wild" wrote:
> >
> >> Are you building this SQL statement in code, or is this the SQL of a
> >> saved
> >> query?
> >>
> >> Try providing the table name for each field...
> >> SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS
> >> LastFirst,
> >> [contractors Master Table].ConNum, [Company Master Table].[Company Name]
> >> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> >> [contractors Master Table].ConNum = [Company Master Table].ConNum
> >>
> >> Also you may need to make clear your WHERE statement with some more
> >> brackets
> >> WHERE ((([contractors Master Table].ConNum=[Forms]![main
> >> menu]![CompanyID])
> >> OR
> >> ([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
> >> Table].Active=Yes))
> >> ORDER BY [Last] & ", " & [First];
> >>
> >> You may also be having the problem because you are using Last and First
> >> as
> >> field names, both of which are reserved words in Access.
> >> --
> >> Joan Wild
> >> Microsoft Access MVP
> >>
> >> Cameron wrote:
> >> > I tried that and I still get an invalid argument error.
> >> >
> >> > "Lynn Trapp" wrote:
> >> >
> >> >> Try changing the Order By clause to simply:
> >> >>
> >> >> ORDER BY [Last], [First]
> >> >>
> >> >> --
> >> >>
> >> >> Lynn Trapp
> >> >> Microsoft MVP (Access)
> >> >> www.ltcomputerdesigns.com
> >> >>
> >> >>
> >> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> >> >>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
> >> >>> Master Table].ConNum, CompanyName
> >> >>> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> >> >>> [contractors Master Table].ConNum = [Company Master Table].ConNum
> >> >>> WHERE ([contractors Master Table].ConNum=[Forms]![main
> >> >>> menu]![CompanyID] OR
> >> >>> [Forms]![main menu]![CompanyID] Is Null) And
> >> >>>            ([contractors Master Table].Active=Yes)
> >> >>> ORDER BY [Last] & ", " & [First];
> >> >>>
> >> >>>
> >> >>>
> >> >>> "Lynn Trapp" wrote:
> >> >>>
> >> >>>> Yes you can. Would you post your SQL?
> >> >>>>
> >> >>>> --
> >> >>>>
> >> >>>> Lynn Trapp
> >> >>>> Microsoft MVP (Access)
> >> >>>> www.ltcomputerdesigns.com
> >> >>>>
> >> >>>>
> >> >>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> >>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> >> >>>>> can you apply a Order By clause to a Inner Join? When I do this I
> >> >>>>> get an
> >> >>>>> invaild Argument error.
> >>
> >>
> >>
>
>
>
Author
7 Dec 2006 1:50 PM
Lynn Trapp
That could be your problem because, as Joan pointed out, Last and First are
reserved words in Access. Try renaming your table fields to some thing
LastName, FirstName.

--

Lynn Trapp
Microsoft MVP (Access)
www.ltcomputerdesigns.com


Show quoteHide quote
"Cameron" <Came***@discussions.microsoft.com> wrote in message
news:1BC35022-F65C-4512-8B9C-4CD06563DF04@microsoft.com...
> Yes, they are.
>
> "Lynn Trapp" wrote:
>
>> Cameron,
>> Joan may be on to something here. Are [Last] and [First] field names in
>> your
>> table?
>>
>> --
>>
>> Lynn Trapp
>> Microsoft MVP (Access)
>> www.ltcomputerdesigns.com
>>
>>
>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> news:C9038F10-A77B-4412-B266-FFEBECA3EBC0@microsoft.com...
>> > It is in a saved query. And I have tried to put in the table names on
>> > the
>> > respective fields. Still got the error
>> >
>> > "Joan Wild" wrote:
>> >
>> >> Are you building this SQL statement in code, or is this the SQL of a
>> >> saved
>> >> query?
>> >>
>> >> Try providing the table name for each field...
>> >> SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS
>> >> LastFirst,
>> >> [contractors Master Table].ConNum, [Company Master Table].[Company
>> >> Name]
>> >> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
>> >> [contractors Master Table].ConNum = [Company Master Table].ConNum
>> >>
>> >> Also you may need to make clear your WHERE statement with some more
>> >> brackets
>> >> WHERE ((([contractors Master Table].ConNum=[Forms]![main
>> >> menu]![CompanyID])
>> >> OR
>> >> ([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
>> >> Table].Active=Yes))
>> >> ORDER BY [Last] & ", " & [First];
>> >>
>> >> You may also be having the problem because you are using Last and
>> >> First
>> >> as
>> >> field names, both of which are reserved words in Access.
>> >> --
>> >> Joan Wild
>> >> Microsoft Access MVP
>> >>
>> >> Cameron wrote:
>> >> > I tried that and I still get an invalid argument error.
>> >> >
>> >> > "Lynn Trapp" wrote:
>> >> >
>> >> >> Try changing the Order By clause to simply:
>> >> >>
>> >> >> ORDER BY [Last], [First]
>> >> >>
>> >> >> --
>> >> >>
>> >> >> Lynn Trapp
>> >> >> Microsoft MVP (Access)
>> >> >> www.ltcomputerdesigns.com
>> >> >>
>> >> >>
>> >> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
>> >> >>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
>> >> >>> Master Table].ConNum, CompanyName
>> >> >>> FROM [contractors Master Table] INNER JOIN [Company Master Table]
>> >> >>> ON
>> >> >>> [contractors Master Table].ConNum = [Company Master Table].ConNum
>> >> >>> WHERE ([contractors Master Table].ConNum=[Forms]![main
>> >> >>> menu]![CompanyID] OR
>> >> >>> [Forms]![main menu]![CompanyID] Is Null) And
>> >> >>>            ([contractors Master Table].Active=Yes)
>> >> >>> ORDER BY [Last] & ", " & [First];
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> "Lynn Trapp" wrote:
>> >> >>>
>> >> >>>> Yes you can. Would you post your SQL?
>> >> >>>>
>> >> >>>> --
>> >> >>>>
>> >> >>>> Lynn Trapp
>> >> >>>> Microsoft MVP (Access)
>> >> >>>> www.ltcomputerdesigns.com
>> >> >>>>
>> >> >>>>
>> >> >>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
>> >> >>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
>> >> >>>>> can you apply a Order By clause to a Inner Join? When I do this
>> >> >>>>> I
>> >> >>>>> get an
>> >> >>>>> invaild Argument error.
>> >>
>> >>
>> >>
>>
>>
>>
Author
7 Dec 2006 2:43 PM
Cameron
The only thing that puts a wrench into that idea is that the Developer who
originally wrote this program and that SQL script said that that function
works fine on her machine. The only difference is that she was contracted to
build this application and isn't physically connected to the work server.

Show quoteHide quote
"Lynn Trapp" wrote:

> That could be your problem because, as Joan pointed out, Last and First are
> reserved words in Access. Try renaming your table fields to some thing
> LastName, FirstName.
>
> --
>
> Lynn Trapp
> Microsoft MVP (Access)
> www.ltcomputerdesigns.com
>
>
> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> news:1BC35022-F65C-4512-8B9C-4CD06563DF04@microsoft.com...
> > Yes, they are.
> >
> > "Lynn Trapp" wrote:
> >
> >> Cameron,
> >> Joan may be on to something here. Are [Last] and [First] field names in
> >> your
> >> table?
> >>
> >> --
> >>
> >> Lynn Trapp
> >> Microsoft MVP (Access)
> >> www.ltcomputerdesigns.com
> >>
> >>
> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> news:C9038F10-A77B-4412-B266-FFEBECA3EBC0@microsoft.com...
> >> > It is in a saved query. And I have tried to put in the table names on
> >> > the
> >> > respective fields. Still got the error
> >> >
> >> > "Joan Wild" wrote:
> >> >
> >> >> Are you building this SQL statement in code, or is this the SQL of a
> >> >> saved
> >> >> query?
> >> >>
> >> >> Try providing the table name for each field...
> >> >> SELECT [Company Master Table].EmpNum, [Last] & ", " & [First] AS
> >> >> LastFirst,
> >> >> [contractors Master Table].ConNum, [Company Master Table].[Company
> >> >> Name]
> >> >> FROM [contractors Master Table] INNER JOIN [Company Master Table] ON
> >> >> [contractors Master Table].ConNum = [Company Master Table].ConNum
> >> >>
> >> >> Also you may need to make clear your WHERE statement with some more
> >> >> brackets
> >> >> WHERE ((([contractors Master Table].ConNum=[Forms]![main
> >> >> menu]![CompanyID])
> >> >> OR
> >> >> ([Forms]![main menu]![CompanyID] Is Null)) And ([contractors Master
> >> >> Table].Active=Yes))
> >> >> ORDER BY [Last] & ", " & [First];
> >> >>
> >> >> You may also be having the problem because you are using Last and
> >> >> First
> >> >> as
> >> >> field names, both of which are reserved words in Access.
> >> >> --
> >> >> Joan Wild
> >> >> Microsoft Access MVP
> >> >>
> >> >> Cameron wrote:
> >> >> > I tried that and I still get an invalid argument error.
> >> >> >
> >> >> > "Lynn Trapp" wrote:
> >> >> >
> >> >> >> Try changing the Order By clause to simply:
> >> >> >>
> >> >> >> ORDER BY [Last], [First]
> >> >> >>
> >> >> >> --
> >> >> >>
> >> >> >> Lynn Trapp
> >> >> >> Microsoft MVP (Access)
> >> >> >> www.ltcomputerdesigns.com
> >> >> >>
> >> >> >>
> >> >> >> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> >> >> news:3EAEABA5-7F77-4CD5-898C-462888EC8619@microsoft.com...
> >> >> >>> SELECT EmpNum, [Last] & ", " & [First] AS LastFirst, [contractors
> >> >> >>> Master Table].ConNum, CompanyName
> >> >> >>> FROM [contractors Master Table] INNER JOIN [Company Master Table]
> >> >> >>> ON
> >> >> >>> [contractors Master Table].ConNum = [Company Master Table].ConNum
> >> >> >>> WHERE ([contractors Master Table].ConNum=[Forms]![main
> >> >> >>> menu]![CompanyID] OR
> >> >> >>> [Forms]![main menu]![CompanyID] Is Null) And
> >> >> >>>            ([contractors Master Table].Active=Yes)
> >> >> >>> ORDER BY [Last] & ", " & [First];
> >> >> >>>
> >> >> >>>
> >> >> >>>
> >> >> >>> "Lynn Trapp" wrote:
> >> >> >>>
> >> >> >>>> Yes you can. Would you post your SQL?
> >> >> >>>>
> >> >> >>>> --
> >> >> >>>>
> >> >> >>>> Lynn Trapp
> >> >> >>>> Microsoft MVP (Access)
> >> >> >>>> www.ltcomputerdesigns.com
> >> >> >>>>
> >> >> >>>>
> >> >> >>>> "Cameron" <Came***@discussions.microsoft.com> wrote in message
> >> >> >>>> news:D2E89D96-4736-4064-90A6-253CC3643DB1@microsoft.com...
> >> >> >>>>> can you apply a Order By clause to a Inner Join? When I do this
> >> >> >>>>> I
> >> >> >>>>> get an
> >> >> >>>>> invaild Argument error.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>