From: jubiiab via AccessMonster.com on
I need to make a Form where the user type:

SampleID: 1234

StartDate: 01-01-2010

EndDate: 01-01-2015

CheckEvery: 3

(There will be more fields but these are the most important)

On this form there should be a subForm because in the subForm it will show
all the due dates:

0 3 6 9
12 15
01-01-2010 01-03-2010 01-06-2010 01-09-2010 01-12-2010 01-03-
2012

...and it continues until it reaches the last date 01-01-2015.

In the “checkEvery” textbox the user should be able to write a number. In
this case I wrote 3 – means that the subform should write the date for every
3rd month. I don't know how to make this subform to add dates automatically?

Is it also possible to make a checkbox for every date it shows? So you can
mark that the sampleID has been analyzed that date?

I am sorry about my English. I know it's not good but I hope you understand
the question or please ask.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: jubiiab via AccessMonster.com on
On this form there should be a subForm because in the subForm it will show
all the due dates:
0 3 6 9
12 15
01-01-2010 01-03-2010 01-06-2010 01-09-2010 01-12-2010 01-03-
2012

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: Daryl S on
Jujiiab -

Since you didn't give any details, the answer will be general, but you can
take the idea and use your table/field/control names to do it. I guessed you
would have the SampleId and DueDate fields in the table behind your subform,
but you will need to use whatever is required for your table.

Set up the form like you said, then add a button for the user to click on
when the data is ready. In the code behind the button, you want to check to
make sure the data is valid (e.g. both dates are entered and the end date is
at least [CheckEvery] months after the start date.

Then append records as needed in a loop, something like this:

Dim dtDue as Date

dtDue = DateAdd("m", Me.CheckEvery, Me.StartDate) 'the first due date
Do Until dtDue > Me.EndDate
DoCmd.RunSQL "INSERT Into tablename ([SampleId],[DueDate]) Values (" & _
Me.SampleID & ", #" & dtDue & "#)"
dtDue = DateAdd("m", Me.CheckEvery, dtDue) 'increment the due date
Loop

Then requery the subform.
Me.subformname.requery

--
Daryl S


"jubiiab via AccessMonster.com" wrote:

> I need to make a Form where the user type:
>
> SampleID: 1234
>
> StartDate: 01-01-2010
>
> EndDate: 01-01-2015
>
> CheckEvery: 3
>
> (There will be more fields but these are the most important)
>
> On this form there should be a subForm because in the subForm it will show
> all the due dates:
>
> 0 3 6 9
> 12 15
> 01-01-2010 01-03-2010 01-06-2010 01-09-2010 01-12-2010 01-03-
> 2012
>
> ...and it continues until it reaches the last date 01-01-2015.
>
> In the “checkEvery” textbox the user should be able to write a number. In
> this case I wrote 3 – means that the subform should write the date for every
> 3rd month. I don't know how to make this subform to add dates automatically?
>
> Is it also possible to make a checkbox for every date it shows? So you can
> mark that the sampleID has been analyzed that date?
>
> I am sorry about my English. I know it's not good but I hope you understand
> the question or please ask.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1
>
> .
>
From: jubiiab via AccessMonster.com on
Hi Daryl

What kind of details do u need more?

I will look at your answer tomorrow at work. thx for your time.


Daryl S wrote:
>Jujiiab -
>
>Since you didn't give any details, the answer will be general, but you can
>take the idea and use your table/field/control names to do it. I guessed you
>would have the SampleId and DueDate fields in the table behind your subform,
>but you will need to use whatever is required for your table.
>
>Set up the form like you said, then add a button for the user to click on
>when the data is ready. In the code behind the button, you want to check to
>make sure the data is valid (e.g. both dates are entered and the end date is
>at least [CheckEvery] months after the start date.
>
>Then append records as needed in a loop, something like this:
>
>Dim dtDue as Date
>
>dtDue = DateAdd("m", Me.CheckEvery, Me.StartDate) 'the first due date
>Do Until dtDue > Me.EndDate
> DoCmd.RunSQL "INSERT Into tablename ([SampleId],[DueDate]) Values (" & _
> Me.SampleID & ", #" & dtDue & "#)"
> dtDue = DateAdd("m", Me.CheckEvery, dtDue) 'increment the due date
>Loop
>
>Then requery the subform.
>Me.subformname.requery
>
>> I need to make a Form where the user type:
>>
>[quoted text clipped - 27 lines]
>> I am sorry about my English. I know it's not good but I hope you understand
>> the question or please ask.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

From: KARL DEWEY on
What you are asking to create is better done in Excel with its autofill.
Fill in the date in 3 cells, highlight those three, use cursor to grab the
lower right corner and then drag to the right until you the number of sells
filled you need. A little popup will follow along telling you the date in
the last cell.

--
Build a little, test a little.


"jubiiab via AccessMonster.com" wrote:

> On this form there should be a subForm because in the subForm it will show
> all the due dates:
> 0 3 6 9
> 12 15
> 01-01-2010 01-03-2010 01-06-2010 01-09-2010 01-12-2010 01-03-
> 2012
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1
>
> .
>
 |  Next  |  Last
Pages: 1 2 3 4 5 6
Prev: Display a message while a form loads
Next: Combo ?