psycoperl
Active Member
- Joined
- Oct 23, 2007
- Messages
- 339
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
- Web
Good morning,
I am facing a dilemma that I cannot solve.
When I run the following code, the Order By in the Select Statement is not respected and the data in the table is not entered in order. When I run the Select statement by its self in the "Query Designer" it shows the records in the order that we need them to be.
DoCmd.RunSQL "Insert Into [tempTrTicket-M3] " & _
"SELECT TK.PrintedName, TK.TestCode, TK.TestDescription, TK.TestDate, TK.TestTime, TK.SRC, TK.Phase, TK.Type, TK.[Student ID], TK.[First Name], TK.MI, TK.[Last Name], TK.Address, TK.City, TK.State, TK.[Zip Code], UCASE(TK.Print) As Print , TK.TicketID, TK.TicketIDLN from [AppointmentTickets-M3-Transfers-1stAppt] TK ORDER BY TK.[Last Name] ASC, TK.[First Name] ASC, TK.MI ASC"
I am facing a dilemma that I cannot solve.
When I run the following code, the Order By in the Select Statement is not respected and the data in the table is not entered in order. When I run the Select statement by its self in the "Query Designer" it shows the records in the order that we need them to be.
DoCmd.RunSQL "Insert Into [tempTrTicket-M3] " & _
"SELECT TK.PrintedName, TK.TestCode, TK.TestDescription, TK.TestDate, TK.TestTime, TK.SRC, TK.Phase, TK.Type, TK.[Student ID], TK.[First Name], TK.MI, TK.[Last Name], TK.Address, TK.City, TK.State, TK.[Zip Code], UCASE(TK.Print) As Print , TK.TicketID, TK.TicketIDLN from [AppointmentTickets-M3-Transfers-1stAppt] TK ORDER BY TK.[Last Name] ASC, TK.[First Name] ASC, TK.MI ASC"