calculation not working

Okay, will do...
 
Silly me, looking right at it and missed it, in your code...
Code:
If Me.Test = "LR" And Me.Time_Received >= #12:00:00 PM# And Me.Time_Received <= #7:00:00 PM# Then
Me.Date_Received = Me.Date_Received + 1
End If
You have not told it what to do if the time is before Noon. Where is that code?

I also noticed you are using words reserved for Access (Case and Day) as field names. This will cause Access confusion, so you need to change those right away. Here's a complete list...
http://allenbrowne.com/AppIssueBadWord.html

Check your entire database, should there be more Tables, and make any corrections you need to.
 
I have removed the Day field and will rename the case field.

Code:
 If Me.Test = "LR" And Me.Time_Received >= #12:00:00 PM# And Me.Time_Received <= #7:00:00 PM# Then
Me.Date_Received = Me.Date_Received + 1
End If

will add 1 day to date_received if the sample is received after noon, i am not sure how to code in:
if the sample is received before 11:59 AM, then "do nothing" or do not add 1 day to date_received. Thank you.
 
Then I am confused because it added the day for me and did not nothing if before or after that time. You do fill in the Date Received right? It can't be empty.
 
I can not access the database from my cell phone so what is supposed to happen is when the HLA ID is filled in the date_received and time_received auto-fill. Then when the Test is selected the Due Date auto-fills based on the test.

So if "LR" is the test and date_received is 7/29/2014 and the time_received is before 11:59 AM, the Due Date is 8/4/2014.

If "LR" is the test and date_received is 7/29/2014 and the time_received is after 12:00 PM, then the date_received is changed to 7/30/2014 and the Due Date is 8/5/2014. Thank you.
 
Due Date? I thought we were working on Date Received? Now I am confused. Is it the Due Date I am looking at?
 
will add 1 day to date_received if the sample is received after noon, i am not sure how to code in:
if the sample is received before 11:59 AM, then "do nothing" or do not add 1 day to date_received. Thank you.
It's already doing nothing. If you don't want it to do anything you don't need to write code for that. Both textboxes mus be bound to the fields.

I can not access the database from my cell phone so what is supposed to happen is when the HLA ID is filled in the date_received and time_received auto-fill. Then when the Test is selected the Due Date auto-fills based on the test.
Wait until you get to your db. And again both textboxes mus be bound to the fields.
Code:
    If Me.test = "LR" And Me.Time_Received >= #12:00:00 PM# Then
        Me.Date_Received = Me.Date_Received + 1
        Me.Due_Date = Me.Due_Date + 1
    End If
 
@vbaInet

Actualy, no Due Date does not have to be bound to anything as it's a calaculation based on Date Received and is calculated by a Function. So, unless awake2424 wants to store a calculated value all is good there and it should be included in the lines of code.
 
@awake2424

Okay, I have just gone back and checked and my Due Date does say 8/4/2014 BUT if you want it to show immediately then you are going to need to put a Me.Text201.Requery in the After_Update event of the Test Combo Box. It won't calculate just because the values of the other fields are filled in.
 
@vbaInet

Actualy, no Due Date does not have to be bound to anything as it's a calaculation based on Date Received and is calculated by a Function. So, unless awake2424 wants to store a calculated value all is good there and it should be included in the lines of code.
Yes I know but from previous responses I get the feeling the OP wants it stored that's why I didn't include an Else statement. If this isn't the case then of course an Else statement is required.
 
@vbaInet

Oh okay... at this point I'm getting confused what is actually wanted! :confused:
 
I apologize for the confusion and have been able to resolve most of the issues. In regards to post 29:

would the requery be and would that requery be based on the new date_received?
Code:
 Private Sub Test_AfterUpdate()
        If Me.Test = "LR" And Me.Time_Received >= #12:00:00 PM# Then
        Me.Date_Received = Me.Date_Received + 1
        Me.Test.Requery
   End If

So, if a sample was date_received 7/29/2014 at time_received 2:00 PM and Test "LR" would the new Due Date be 8/5/2014 because the new date_received is 7/30/2014?  Thanks.
 
At this point because of all the confusion. Please look at what you have and tell us does it work.
 

Users who are viewing this thread

Back
Top Bottom