I have a form with 25 appointment times (records) for 7 days Fields). I need to enter the date for each of the 7 days against each of the time slots. I can achieve this, but with very lengthy code. This works Ok. I have 7 unbound controls named txtDay1 to txtDay7. The 7 day fields are called Day1 to Day7 . I enter in the different dates of the appointments in the 7 txtDay* controls. I then run the following code.
DoCmd.GoToRecord , , acFirst
If IsNull(Me![txtDay1]) = False Then
Day1 = [txtDay1]
DoCmd.GoToRecord , , acNext
Day1 = [txtDay1]
DoCmd.GoToRecord , , acNext
Day1 = [txtDay1]
This code is repeated 25 times to populate the 25 time slots with the date entered into the control txtDay1 so that against each time slot for Day1 is the date held in the control txtDay1.
This event is carried out for each of the seven days, so making a lot of lengthy coding. I am sure that using a record count or something, or a do, while, loop or something, that this bulky coding can be reduced to just a few lines of code, yet still do the same thing. I have tried all sorts but with no luck.
I would appreciate any help on this, as i am rather stuck on an important project.
Thanks for taking the time to at least read this.
Scoffagus
DoCmd.GoToRecord , , acFirst
If IsNull(Me![txtDay1]) = False Then
Day1 = [txtDay1]
DoCmd.GoToRecord , , acNext
Day1 = [txtDay1]
DoCmd.GoToRecord , , acNext
Day1 = [txtDay1]
This code is repeated 25 times to populate the 25 time slots with the date entered into the control txtDay1 so that against each time slot for Day1 is the date held in the control txtDay1.
This event is carried out for each of the seven days, so making a lot of lengthy coding. I am sure that using a record count or something, or a do, while, loop or something, that this bulky coding can be reduced to just a few lines of code, yet still do the same thing. I have tried all sorts but with no luck.
I would appreciate any help on this, as i am rather stuck on an important project.
Thanks for taking the time to at least read this.
Scoffagus