473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Horrible Mapping Problem

Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).

Example:

Student <name>
Year <year>

......1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
....
Dec....I..S...S

My problem is, how do I map a table such as:

<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
....
etc.

into the above tabular calendar report?

I would prefer that the calendar be a form or a report, but I'll settle
for a query.

Any help would be appreciated!

Stan

Dec 15 '06 #1
5 1305

ShadesOfGrey wrote:
Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).

Example:

Student <name>
Year <year>

.....1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
...
Dec....I..S...S

My problem is, how do I map a table such as:

<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
...
etc.

into the above tabular calendar report?

I would prefer that the calendar be a form or a report, but I'll settle
for a query.
Well, since the form or report will likely be based on a query, we'll
start with that. Create a new query. Cancel out of the "Show Table"
dialog. Switch to SQL view and paste in the following, replacing the
"SELECT;" that is already there. Adjust the table and column names to
match yours. It should give you something close to what you seek.

TRANSFORM First(IIf([Attendance_Type]=1,"S","I")) AS Type
SELECT Year([Attendance_Date]) AS [Year], Month([Attendance_Date]) AS
[Month], Students.Name
FROM Attendance INNER JOIN Students ON Attendance.Student_ID =
Students.Student_ID
GROUP BY Year([Attendance_Date]), Month([Attendance_Date]),
Students.Name
PIVOT Day([Attendance_Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

Dec 15 '06 #2
Thank you for the tip, but I'm no SQL person. This is your query
written with my table and field names:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT [First Name] & " " & [Last Name] AS Name, Year([Date]) AS
[Year], Month([Date]) AS [Month]
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), Name
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

However, it doesn't like my "Name" concatenation for some reason, even
though the exact same syntax is in another query's SQL statement (I
looked there for example syntax), which works perfectly (except for not
doing what I need).

Any thoughts?
Gord wrote:
ShadesOfGrey wrote:
Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).

Example:

Student <name>
Year <year>

.....1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
...
Dec....I..S...S

My problem is, how do I map a table such as:

<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
...
etc.

into the above tabular calendar report?

I would prefer that the calendar be a form or a report, but I'll settle
for a query.

Well, since the form or report will likely be based on a query, we'll
start with that. Create a new query. Cancel out of the "Show Table"
dialog. Switch to SQL view and paste in the following, replacing the
"SELECT;" that is already there. Adjust the table and column names to
match yours. It should give you something close to what you seek.

TRANSFORM First(IIf([Attendance_Type]=1,"S","I")) AS Type
SELECT Year([Attendance_Date]) AS [Year], Month([Attendance_Date]) AS
[Month], Students.Name
FROM Attendance INNER JOIN Students ON Attendance.Student_ID =
Students.Student_ID
GROUP BY Year([Attendance_Date]), Month([Attendance_Date]),
Students.Name
PIVOT Day([Attendance_Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);
Dec 15 '06 #3
Immediately after posting, I saw a part of what I was doing
incorrectly.

I have [First Name] and [Last Name] as separate fields in
Member_List_tbl but I want the query to accept First&Last as a
parameter along with the year. So, if Year = [Enter Year] is 2006,
only Jan - Dec 2006 will output. And if Name = [Enter Name] is "FName
LName" only records for "FName LName" will appear.

This query ALMOST does what I need.

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT Year([Date]) AS [Year], Month([Date]) AS [Month], Name AS Expr1
FROM Member_List_tbl INNER JOIN Attendance_tbl ON Member_List_tbl.[ID
Number] = Attendance_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), Name
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);


ShadesOfGrey wrote:
Thank you for the tip, but I'm no SQL person. This is your query
written with my table and field names:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT [First Name] & " " & [Last Name] AS Name, Year([Date]) AS
[Year], Month([Date]) AS [Month]
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), Name
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

However, it doesn't like my "Name" concatenation for some reason, even
though the exact same syntax is in another query's SQL statement (I
looked there for example syntax), which works perfectly (except for not
doing what I need).

Any thoughts?
Gord wrote:
ShadesOfGrey wrote:
Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).
>
Example:
>
Student <name>
Year <year>
>
.....1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
...
Dec....I..S...S
>
My problem is, how do I map a table such as:
>
<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
...
etc.
>
into the above tabular calendar report?
>
I would prefer that the calendar be a form or a report, but I'll settle
for a query.
Well, since the form or report will likely be based on a query, we'll
start with that. Create a new query. Cancel out of the "Show Table"
dialog. Switch to SQL view and paste in the following, replacing the
"SELECT;" that is already there. Adjust the table and column names to
match yours. It should give you something close to what you seek.

TRANSFORM First(IIf([Attendance_Type]=1,"S","I")) AS Type
SELECT Year([Attendance_Date]) AS [Year], Month([Attendance_Date]) AS
[Month], Students.Name
FROM Attendance INNER JOIN Students ON Attendance.Student_ID =
Students.Student_ID
GROUP BY Year([Attendance_Date]), Month([Attendance_Date]),
Students.Name
PIVOT Day([Attendance_Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);
Dec 15 '06 #4

ShadesOfGrey wrote:
Thank you for the tip, but I'm no SQL person. This is your query
written with my table and field names:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT [First Name] & " " & [Last Name] AS Name, Year([Date]) AS
[Year], Month([Date]) AS [Month]
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), Name
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

However, it doesn't like my "Name" concatenation for some reason, even
though the exact same syntax is in another query's SQL statement (I
looked there for example syntax), which works perfectly (except for not
doing what I need).

Any thoughts?
Try this:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT Year([Date]) AS [Year], Month([Date]) AS [Month], [First Name] &
" " & [Last Name] AS Name
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), [First Name] & " " & [Last Name]
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

Gord wrote:
ShadesOfGrey wrote:
Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).
>
Example:
>
Student <name>
Year <year>
>
.....1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
...
Dec....I..S...S
>
My problem is, how do I map a table such as:
>
<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
...
etc.
>
into the above tabular calendar report?
>
I would prefer that the calendar be a form or a report, but I'll settle
for a query.
Well, since the form or report will likely be based on a query, we'll
start with that. Create a new query. Cancel out of the "Show Table"
dialog. Switch to SQL view and paste in the following, replacing the
"SELECT;" that is already there. Adjust the table and column names to
match yours. It should give you something close to what you seek.

TRANSFORM First(IIf([Attendance_Type]=1,"S","I")) AS Type
SELECT Year([Attendance_Date]) AS [Year], Month([Attendance_Date]) AS
[Month], Students.Name
FROM Attendance INNER JOIN Students ON Attendance.Student_ID =
Students.Student_ID
GROUP BY Year([Attendance_Date]), Month([Attendance_Date]),
Students.Name
PIVOT Day([Attendance_Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);
Dec 15 '06 #5
This modification to your query does the trick!

PARAMETERS [Enter Name] Text ( 255 ), [Enter Year] IEEEDouble;
TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT Year([Date]) AS [Year], Month([Date]) AS [Month], [First Name] &
" " & [Last Name] AS Name
FROM Member_List_tbl INNER JOIN Attendance_tbl ON Member_List_tbl.[ID
Number] = Attendance_tbl.[ID Number]
WHERE ((([First Name] & " " & [Last Name])=[Enter Name]) AND
((DatePart("yyyy",[Date]))=[Enter Year]))
GROUP BY Year([Date]), Month([Date]), [First Name] & " " & [Last Name]
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

Now to figure out how to pass the parameters from a form (my entry form
is supposed to pop up this query after it processes). It can't be too
hard. :)

Thanks a ton for your help!
Gord wrote:
ShadesOfGrey wrote:
Thank you for the tip, but I'm no SQL person. This is your query
written with my table and field names:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT [First Name] & " " & [Last Name] AS Name, Year([Date]) AS
[Year], Month([Date]) AS [Month]
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), Name
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

However, it doesn't like my "Name" concatenation for some reason, even
though the exact same syntax is in another query's SQL statement (I
looked there for example syntax), which works perfectly (except for not
doing what I need).

Any thoughts?

Try this:

TRANSFORM First(IIf([Mem Type]=1,"S","I")) AS Type
SELECT Year([Date]) AS [Year], Month([Date]) AS [Month], [First Name] &
" " & [Last Name] AS Name
FROM Attendance_tbl INNER JOIN Member_List_tbl ON Attendance_tbl.[ID
Number] = Member_List_tbl.[ID Number]
GROUP BY Year([Date]), Month([Date]), [First Name] & " " & [Last Name]
PIVOT Day([Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);

Gord wrote:
ShadesOfGrey wrote:
Hi, new to the group, not to Access...but it's been awhile since I've
done much with it. I am creating a database that tracks student and
instructor attendance. I have two tables, one for student information
and one for the attendance records. I want to create a report that
takes the attendance record with fields Record Number, Student ID,
Date, and Type (student or instructor) and outputs it as a tabular
calendar showing "S" for Student and "I" for instructor (each person
can be either, but not both on the same day).

Example:

Student <name>
Year <year>

.....1.2.3.4.5.6.7...31
Jan..S...S....I
Feb.......S...S
...
Dec....I..S...S

My problem is, how do I map a table such as:

<RecNo><Name><Date><Type>
RecNo1...Bob Robertson...12/1/2006...1
RecNo2...Bob Robertson...12/2/2006...2
RecNo3...Tim Franklin....12/1/2006...1
...
etc.

into the above tabular calendar report?

I would prefer that the calendar be a form or a report, but I'll settle
for a query.
>
Well, since the form or report will likely be based on a query, we'll
start with that. Create a new query. Cancel out of the "Show Table"
dialog. Switch to SQL view and paste in the following, replacing the
"SELECT;" that is already there. Adjust the table and column names to
match yours. It should give you something close to what you seek.
>
TRANSFORM First(IIf([Attendance_Type]=1,"S","I")) AS Type
SELECT Year([Attendance_Date]) AS [Year], Month([Attendance_Date]) AS
[Month], Students.Name
FROM Attendance INNER JOIN Students ON Attendance.Student_ID =
Students.Student_ID
GROUP BY Year([Attendance_Date]), Month([Attendance_Date]),
Students.Name
PIVOT Day([Attendance_Date]) In
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,2 0,21,22,23,24,25,26,27,28,29,30,31);
Dec 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ian Turner | last post by:
Hi, In an attempt to get every request for a particular virtual directory to go through ASP.NET I've been trying to add a wildcard application mapping. The scenario is that any url for that VD,...
2
by: Danny Miller | last post by:
Hi there, I'm facing a problem that is driving me nuts. The scenario is as follows: 1) Create an empty directory structure e.g. C:\Dev1\TestWebApp 2) Map a virtual directory e.g. TestWebApp...
6
by: Michael Tissington | last post by:
I'm trying to add some extensions to IIS on the properties, home directory, config screen. I must be missing something because the OK button is always disabled ... Any ideas please ? --...
1
by: none | last post by:
Hi, I'm trying to establish table mappings, and I've hit a snag. At the point to where I try to fill the schema (DB_adapter.FillSchema), I get an exception, and the message is as follows:...
0
by: Thomas | last post by:
in .net 1.1 we successfully use a HttpModule to catch 404 / 403.1 html errors. after migrating to .net 2.0, this modules is broken in a very, very strange way. we have defined a wildcard...
13
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path...
0
by: marcosalvadeo | last post by:
I have a problem. I created a dataset in visual studio 2005 which use tables of SQL Server Mobile. When I create insert query in the relative TableAdapter, the dataset designer maps the type...
5
by: alan | last post by:
Hello world, I'm wondering if it's possible to implement some sort of class/object that can perform mapping from class types to strings? I will know the class type at compile time, like so:...
22
by: tenxian | last post by:
Could you put up with the horrible PHP code?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.