Hello from Cleveland Ohio (1 Viewer)

Lkwdmntr

Registered User.
Local time
Today, 07:18
Joined
Jul 10, 2019
Messages
277
Hello,
This is my first post. I have never worked on these types of sites before, so I apologize in advance if I do anything wrong. I do have a question that I am struggling with, but am not sure this is where I should post it. Here it goes, and redirect me to another forum if needed.

Q: I am working on a project that creates a plan using several forms and tables. On the final form when I hit the button to create the plan a series of reports are produced and updates to a lot of the ables take place. What I want to do is to copy all the data from all the tables where the "UserID and "WeekNumber" are equal, into records for the next week. The only difference is that the "WeekNumber" needs to add 1, and the "StartDate" needs to add 7 days. Any idea of how I am to pull this off?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:18
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to AWF! You might check out TempVars. You can use them to store values that you can access from almost anywhere in your application.
 

jdraw

Super Moderator
Staff member
Local time
Today, 10:18
Joined
Jan 23, 2006
Messages
15,364
Welcome to AWF. Glad to have you aboard.
 

isladogs

MVP / VIP
Local time
Today, 14:18
Joined
Jan 14, 2017
Messages
18,186
Hi
Welcome from me as well.
You can use update queries for this if you want to update existing records. Or if you need new records for the following week, use append queries.

For example this would add a new record for each existing record into Table2
Code:
INSERT INTO Table2 ( UserID, WeekNumber, StartDate )
SELECT Table2.UserID, [WeekNumber]+1 AS Expr1, [StartDate]+7 AS Expr2
FROM Table2;
You would need to filter this for the conditions you stated

Hope that helps
 

Lkwdmntr

Registered User.
Local time
Today, 07:18
Joined
Jul 10, 2019
Messages
277
Thanks, Looks like I will need to study up on "appending". I'll let you know if I get stuck or need some help. I wish I found this site when I started this project. I knew nothing about Access and even more of nothing about VBA. I have learned a lot in the last couple of months. Nice to know you guys are here.
 

Users who are viewing this thread

Top Bottom