See my other reply.
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Jul 25, 2017, at 8:23 PM, Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John,
By the way the Unload event worked. I just needed to close the database and reopen it.
Jim Wagner
On Tue Jul 25 2017 11:21:01 GMT-0700 (US Mountain Standard Time), Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John,
The first query SQL
SELECT [R&D-CURRENTEMPLOYEES].[Dept Id], [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm], [R&D-CURRENTEMPLOYEES].[Dept Ld], [R&D-CURRENTEMPLOYEES].[Empl Stat Cd], [R&D-CURRENTEMPLOYEES].[Person Id], [R&D-CURRENTEMPLOYEES].[Empl Fte Pct], [R&D-CURRENTEMPLOYEES].[Flsa Stat Cd], [R&D-CURRENTEMPLOYEES].[Flsa Stat Ld], EmployeeSchedules.M, EmployeeSchedules.T, EmployeeSchedules.W, EmployeeSchedules.TH, EmployeeSchedules.F, EmployeeSchedules.SAT, EmployeeSchedules.SUN, EmployeeSchedules.TRAVELREDDAY, EmployeeSchedules.MonFrom, EmployeeSchedules.MonTo, EmployeeSchedules.TuesFrom, EmployeeSchedules.TuesTo, EmployeeSchedules.WedFrom, EmployeeSchedules.WedTo, EmployeeSchedules.ThursFrom, EmployeeSchedules.ThursTo, EmployeeSchedules.FriFrom, EmployeeSchedules.FriTo, EmployeeSchedules.SatFrom, EmployeeSchedules.SatTo, EmployeeSchedules.SunFrom, EmployeeSchedules.SunTo, EmployeeSchedules.vacflag, EmployeeSchedules.Scheduletype, EmployeeSchedules.comments, EmployeeSchedules.compflag INTO SCHEDULEDATA
FROM [R&D-CURRENTEMPLOYEES] INNER JOIN EmployeeSchedules ON [R&D-CURRENTEMPLOYEES].[Person Id] = EmployeeSchedules.[Person Id]
GROUP BY [R&D-CURRENTEMPLOYEES].[Dept Id], [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm], [R&D-CURRENTEMPLOYEES].[Dept Ld], [R&D-CURRENTEMPLOYEES].[Empl Stat Cd], [R&D-CURRENTEMPLOYEES].[Person Id], [R&D-CURRENTEMPLOYEES].[Empl Fte Pct], [R&D-CURRENTEMPLOYEES].[Flsa Stat Cd], [R&D-CURRENTEMPLOYEES].[Flsa Stat Ld], EmployeeSchedules.M, EmployeeSchedules.T, EmployeeSchedules.W, EmployeeSchedules.TH, EmployeeSchedules.F, EmployeeSchedules.SAT, EmployeeSchedules.SUN, EmployeeSchedules.TRAVELREDDAY, EmployeeSchedules.MonFrom, EmployeeSchedules.MonTo, EmployeeSchedules.TuesFrom, EmployeeSchedules.TuesTo, EmployeeSchedules.WedFrom, EmployeeSchedules.WedTo, EmployeeSchedules.ThursFrom, EmployeeSchedules.ThursTo, EmployeeSchedules.FriFrom, EmployeeSchedules.FriTo, EmployeeSchedules.SatFrom, EmployeeSchedules.SatTo, EmployeeSchedules.SunFrom, EmployeeSchedules.SunTo, EmployeeSchedules.vacflag, EmployeeSchedules.Scheduletype, EmployeeSchedules.comments, EmployeeSchedules.compflag
ORDER BY [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm];
FROM [R&D-CURRENTEMPLOYEES] INNER JOIN EmployeeSchedules ON [R&D-CURRENTEMPLOYEES].[Person Id] = EmployeeSchedules.[Person Id]
GROUP BY [R&D-CURRENTEMPLOYEES].[Dept Id], [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm], [R&D-CURRENTEMPLOYEES].[Dept Ld], [R&D-CURRENTEMPLOYEES].[Empl Stat Cd], [R&D-CURRENTEMPLOYEES].[Person Id], [R&D-CURRENTEMPLOYEES].[Empl Fte Pct], [R&D-CURRENTEMPLOYEES].[Flsa Stat Cd], [R&D-CURRENTEMPLOYEES].[Flsa Stat Ld], EmployeeSchedules.M, EmployeeSchedules.T, EmployeeSchedules.W, EmployeeSchedules.TH, EmployeeSchedules.F, EmployeeSchedules.SAT, EmployeeSchedules.SUN, EmployeeSchedules.TRAVELREDDAY, EmployeeSchedules.MonFrom, EmployeeSchedules.MonTo, EmployeeSchedules.TuesFrom, EmployeeSchedules.TuesTo, EmployeeSchedules.WedFrom, EmployeeSchedules.WedTo, EmployeeSchedules.ThursFrom, EmployeeSchedules.ThursTo, EmployeeSchedules.FriFrom, EmployeeSchedules.FriTo, EmployeeSchedules.SatFrom, EmployeeSchedules.SatTo, EmployeeSchedules.SunFrom, EmployeeSchedules.SunTo, EmployeeSchedules.vacflag, EmployeeSchedules.Scheduletype, EmployeeSchedules.comments, EmployeeSchedules.compflag
ORDER BY [R&D-CURRENTEMPLOYEES].[Last Nm], [R&D-CURRENTEMPLOYEES].[First Nm];
The second query SQL
UPDATE SCHEDULEDATA SET SCHEDULEDATA.TRAVELREDDAY = "NA"
WHERE (((SCHEDULEDATA.[Empl Fte Pct])<0.5));
WHERE (((SCHEDULEDATA.[Empl Fte Pct])<0.5));
The Function running after the queries.
Jim Wagner
On Tue Jul 25 2017 10:38:41 GMT-0700 (US Mountain Standard Time), John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Make Table queries are a bad idea - you have no control over the data types Access chooses to use, and the table has no keys.
It's better to pre-define the table, then run a DELETE * followed by an INSERT. Why is it doing an update? Isn't the Make Table loading all the rows you need? What's the SQL of the two queries?
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Jul 25, 2017, at 7:34 PM, Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John,
The macro is running a query that is a make table query and then an update query on the table . I am assuming that the table is not built and updated yet before the form closes. But the unload event did not work.
Jim Wagner
On Tue Jul 25 2017 10:26:16 GMT-0700 (US Mountain Standard Time), John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Try using the Unload event instead.
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Jul 25, 2017, at 7:20 PM, luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
__._,_.___
Posted by: John Viescas <johnv@msn.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (8) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar