Open your form in design view. As I understant it you fill in a date in this form in some field. Select that field, and open its properties (F4). Look for the property name, and name it tb_Date or whatever you find practical. Don't use spaces in control names.
Next click the tab "Event" and find the event called AfterUpdate. You should see a small box with 3 dots on the far right. Click the dots and select Event Procedure.
Your now in VBA mode, Visual Basic for Aplications. Might seem scary at first, but its actually not so hard.
If you named it tb_Date access will allready have added some code for you:
- Private Sub tb_Date_AfterUpdate()
-
Me.tb_DateEnd=DateAdd("d",1,Me.tb_Date)
-
End Sub
This is an event procedure, a small piece of code to be executed after the field tb_Date is updated, I.E. after you have entered the first date. Now we want it to do something.
Go back to your form, and select the field you want to be automatically filled in, and name it. In my example I just named tb_DateEnd. You can call controls almost anything, but its a good idea to not have spaces in it, and there are a few reserved words like "Date", which you should not use
- Private Sub tb_Date_AfterUpdate()
-
Me.tb_DateEnd=DateAdd("d",1,Me.tb_Date)
-
End Sub
This code says, after updating tb_Date, we want to perform some code. We want to set the field tb_DateEnd in the current form (Me is a reference to the current form) equal to something, so we call a built in function DateAdd. If you want information about DateAdd, just click on DateAdd and press F1. The first argument "d" tells the function we want to add DAYS (M for Months) to something. The 1 says how many of "d" we want to add, and finally Me.tb_Date is the variable we want to add something to.
The above code could also be written as:
- Private Sub tb_Date_AfterUpdate()
-
Me.tb_DateEnd.Value=DateAdd("d",1,Me.tb_Date.Value)
-
End Sub
However when Value is excluded Access defaults to assuming you wanted hte Value property.
If you have more questions feel free to ask (Possibly in a seperate thread)