Text Box Madness...

Deirdre Marie

Access in Excess
Local time
Today, 10:41
Joined
Sep 17, 2001
Messages
34
Greetings~

I have created a database which tracks the amount of pheresis donations of a patient.

I have a text box to record the date of the last donation [LastDonation].
I have a text box to record the number of donations [NumberofDonations].
I also have several text boxes to record the dates of milestone donations such as 25, 50, 100 etc
[Donation25], [Donation50] etc..

What I would LIKE to do, and have been unable to correctly do, is the following:

When the [NumberofDonations] reaches a milestone mark (25, 50, 100, etc) I would like the [LastDonation] field to be automatically entered in the appropriate milestone datebox [Donation25], [Donation50] etc.

My simple event procedure I entered does not seem to be doing this for me. This is how I have it written:

Private Sub Donation25_AfterUpdate()
If Me.NumberofDonations = "25" Then Me.Donation25 = Me.LastDonation

End Sub

Further, I would like for the [Donation25] information to remain on the form even if the [NumberofDonations] exceeds 25.

Your assistance is most appreciated. Thank you in advance for your time.

:: waves to Alexandre and whispers, "I'm learning!" ::
 
You need to have the update occur during the After Update event of our NumberofDonations text box:


Private Sub NumberofDonations _AfterUpdate()
If Me.NumberofDonations = "25" Then Me.Donation25 = Me.LastDonation

End Sub

You'll have to work out the exact timing of this as it will depend on when you update your NumberofDonations text box in relation to your LastDonation text box.
 
Thank you very much for the expeditious reply.

I've entered the information as you suggested, however it is still not working for me. I even tried the event procedure to work "On Change"

Basically, I have a check box [AddaDonation] that when checked adds +1 to the [NumberofDonations] text box. The person will check the [AddaDonation] box after entering the date of [LastDonation].

So, in summary:

Person enters / finds patient information.
Person enters [LastDonation] date.
Person checks [AddaDonation] which will +1 to [NumberofDonation]

When the [NumberofDonation] text box reaches a milestone of 25, I would like for the [LastDonation] date (This will rarely be Now() and therefore needs to be the date as typed in the lastdonation field) to be entered in the separate text box of [Donation25] and remain on record.

I hope this clarifies a bit.

:: bites on pencil and squints at screen ::
 
have you tried putting in the OnCurrent() event on the form?

[This message has been edited by crosmill (edited 11-07-2001).]
 
I am running Access97 and do not see an On Current() option for my event. I've tried it with After Update and On Change with no success.

I am not sure if thats (On Current) is a new feature with 2000, or an add-in - but I do not see that.

:: grinds teeth ::
 
The On Current is in the forms properties, double click the square in the top left of the form in design view, then the events tab, it's the first one!
 
Excellent - Progress is made!

That definitely records the date as wanted. Thank you very much for your patience and time. It is very much appreciated.

My teeth thank you as well - no more pencil biting!
wink.gif


~Deirdre
 
The On Current relates to the form properties not the control. But I assume you are using code to increment the NumberofDonations. Why not tag onto that code an if...then...elseif statement as you have tried to do on the form to check after the NumberofDonations is 25,50 etc to transfer the data to the Donations25 field etc.

Oops....too late !

[This message has been edited by Fizzio (edited 11-07-2001).]
 

Users who are viewing this thread

Back
Top Bottom