Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy info on a form and using do while loop to paste 1

Status
Not open for further replies.

corner40

Technical User
Nov 20, 2002
126
CA
well it's not really copy pasting...
this is my problem
I have an IF statement that is for if a person wants to take lessons on mulitple days it copies the information on the table and increments the date of the lesson and the visit day# and then fills in the form with all of the same info...and if statment to start everything off...if its true then my variables are declared...all of the fields on the form get copied to the variables, then I have a do while loop that fills in the form until the visit day# is the same as the #ofdays...
1) my code is pretty big and bulky, I'd love some ideas to slim it down...
2)my loop isn't quite doing what I want...when I start the loop and begin filling in the fields with what is stored in the variables, for the date fields I increment the date by +1 and then store it in the field name...problem is that my dates keep incrementing by +2 everytime...even if I change the incremnt to,say, +4 it still goes up by +2...
3)my do while statement keeps going one past what it should, even if I have < or <= in my statement...it will do the one extra when you begin enter data for the next person/record...

sorry if I kind of rambled...hope this makes a little sense for you all...feel free to ask more questions of me...
thanks in advance
 
Hi

It would be helpful if you could post the code here so we can have a look at it.

As a general comment, you should use the DateAdd function for adding (or subtracting) date, so to add a day would be:

DateAdd(&quot;d&quot;,1,yourdate)

Assuming you have a field somewhere that holds the last date needed, you can
Do Until rst![yourdate] = [enddate] or similar...
if it still goes one too many you can use
Do Until rst![yourdate] = DateAdd(&quot;d&quot;,-1,[enddate] which will stop it one earlier.

As I say, if this doesn't help, post the code so we can see what's going on.

HTH Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Hi Nigel

thanks for the reply...I would post the code but it is pretty big and don't know if it would all fit...like I said before it is pretty big and obtrusive...my email address is corner40@hotmail.com if you don't feel like posting your email address on here then mail me and I can send you the coding if you wouldn't mind...thanks a bunch...
Jeremy
 
Jeremy

Feel free to send it on to nigel.p.barton@btopenworld.com and I'll take a look- no promises though as there are those here who are far more expert than me!

Won't be until later today as I am working at the moment and not allowed to receive personal emails here! Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top