By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,190 Members | 1,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,190 IT Pros & Developers. It's quick & easy.

Autofill Date by 14 days

P: 4
Hello,

Very new to Access. I searched this forum but didn't even know where to start.

I come from a programming background so I'm not afraid of logic :)

What I want to do:

When someone enters a Date in, say, FieldDate, I want FieldDateDue to be 14 days later.


I have tried many things I thought would work but I'm stumped (even went so far as to read the Help ;) )

Can anyone help or point me in the right direction?

Thanks
Jan 12 '07 #1
Share this Question
Share on Google+
9 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hello,

Very new to Access. I searched this forum but didn't even know where to start.

I come from a programming background so I'm not afraid of logic :)

What I want to do:

When someone enters a Date in, say, FieldDate, I want FieldDateDue to be 14 days later.


I have tried many things I thought would work but I'm stumped (even went so far as to read the Help ;) )

Can anyone help or point me in the right direction?

Thanks
You have to use a Data Entry Form. In the After Update event of FieldDate put the following VBA code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub FieldDate_AfterUpdate()
  2.  
  3.    Me.FieldDateDue = Me.FieldDate + 14
  4.  
  5. End Sub
  6.  
Mary
Jan 12 '07 #2

P: 4
You have to use a Data Entry Form. In the After Update event of FieldDate put the following VBA code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub FieldDate_AfterUpdate()
  2.  
  3.    Me.FieldDateDue = Me.FieldDate + 14
  4.  
  5. End Sub
  6.  
Mary
Thank you for the quick reply.

How do I find the Data Entry Form to enter the code into the appropriate Field?

Thanks
Jan 14 '07 #3

P: 4
in design view right-click on the field date text field, select properties, select the events tab, click AfterUpdate, click the ellipsis to the right, choose code builder
Jan 14 '07 #4

P: 4
in design view right-click on the field date text field, select properties, select the events tab, click AfterUpdate, click the ellipsis to the right, choose code builder
Thank you for the reply. I really appreciate the help.

I did everything you said there. I don't get an events tab. I only have a "General" tab.

I've been in/out/up/down/sideways with the different fields, different points of entry, different types of test databases and still can't find the Events tab.

I've done every item in every menu option... nothing.

Here is my Properties window.



I am running Access 2003, if that makes any difference.

What am I doing wrong?

Thanks
Jan 14 '07 #5

NeoPa
Expert Mod 15k+
P: 31,494
Good reply Nyaki.
From that I can see that you were not in the form, and more specifically, not in the TextBox control before you selected properties.
  1. Open the form in Design View.
  2. Click on the FieldDate TextBox.
  3. Select Properties (Alt-Enter).
  4. Scroll down to the After Update property and select [Event Procedure] from the list.
  5. Click on the ellipsis.
  6. You should now find yourself in the VBA window with the Event procedure started for you.
:)
Jan 14 '07 #6

P: 4
Good reply Nyaki.
From that I can see that you were not in the form, and more specifically, not in the TextBox control before you selected properties.
  1. Open the form in Design View.
  2. Click on the FieldDate TextBox.
  3. Select Properties (Alt-Enter).
  4. Scroll down to the After Update property and select [Event Procedure] from the list.
  5. Click on the ellipsis.
  6. You should now find yourself in the VBA window with the Event procedure started for you.
:)
I SEE THE LIGHT... :)

OK... This is what I was doing wrong (or otherwise put... this is where I got really confused...)...

1) I was still in the TABLE design. I hadn't worked my way to the FORM design because, well, I wasn't ready to enter info into the table yet (I was working on solving this problem).

2) I was going to what I thought was the TEXT BOX in Table Design mode (i.e. where you type in the name) and not the FORM Text Box where you actually put in the data.

3) Looking back on this thread AFTER I got this puppy working, I see where my misunderstanding of the lingo came up.

So, for those as new to Access as I am, here is my Totally Green Not Knowing Access At All Step-By-Step:

1) After creating the table OR as you are creating the table, save it.
2) Go to Forms in the Objects list. Open up your Database.
3) NOW Follow all of the steps given above :)

Thanks everyone for helping me out. I'm sure I'll have a few more questions in the future :)

nyakki
Jan 15 '07 #7

NeoPa
Expert Mod 15k+
P: 31,494
When you posted the properties window you got, I could see what had happened.
This is a good illustration of where intelligent communication can get you where you need to go without the need for various posts backwards and forwards - one side trying to understand the other.
Jan 15 '07 #8

P: 7
how would be done for business days only, no weekends or holidays
Aug 8 '08 #9

NeoPa
Expert Mod 15k+
P: 31,494
how would be done for business days only, no weekends or holidays
You need to ask this question in a separate thread. We don't allow members to ask different (even if slightly related) questions in other threads.

I'm sure if you post this you will find someone willing to help you progress with it.

Welcome to Bytes!
Aug 9 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.