Using MS Access/Make-Table query

Advertisement


Question
QUESTION: Hello,
I am having trouble figuring out how to auto assign a number to a record.

I have a query that has USER_ID and Posting_Date. I am trying to create a table and add a third column called Pay_Period.

If the Posting_Date falls between 1/1/13 - 1/15/13, then the Pay_Period column should assign the records to 1. If the Posting_Date falls between 1/16/13 - 1/31/13, then the Pay_Period column should assign all records between those dates to 2, and so on.

How do I auto assign the Pay_Period according the the User's Posting Date? I was told to do a Make-Table Query first, but I'm not sure what to do after that.

Thank you for your help.

ANSWER: You need a table like this:

tblPayPeriods
PayPeriodID (PK)
StartDate
EndDate

From there you can assign the payperiod by looking up the posting date against that table.

Hope this helps,
Scott<>



---------- FOLLOW-UP ----------

QUESTION: Thanks for the quick reply. I do have a reference table like that. But how do I assign it by looking up the posting date against the table?

Answer
What is the structure of your tables? What does the SQL for your queries look like?

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.