Search results

  1. A

    calculated field

    All I have for that is in post 1, it was a last ditch effort to try and make the calculation work. In the link there are two different functions, but neither seemed to work. Thank you.
  2. A

    calculated field

    I have also tried the two functions here: http://www.access-programmers.co.uk/forums/showthread.php?t=269422 I did not know where best to post this, but have not been able to figure it out. The calculation seems to be including the weekend ( amd probably the holidays as well, but I am not...
  3. A

    calculated field

    Trying to calculate the integer difference between Due_Date and Result_Date excluding weekends and holidays. I have a table (Holidays) with the dates of the holidays in it. The table looks like: ID Description Holiday 1 New Years 1/1/2014 2 New Years 1/1/2015 So, if...
  4. A

    wrong value callculated

    Re: wrong value calculated Due_Date: 9/25/2014 and Result_Date: 9/29/2014 = TAT: 4 (should be 2) Public Function Weekdays(ByRef startDate As Date, _ ByRef endDate As Date _ ) As Integer ' Returns the number of weekdays in the period from startDate ' to endDate inclusive...
  5. A

    wrong value callculated

    I can not figure out why the below calculates TAT as 5 not 2. Basically, I am trying to calculate a integer number difference from two dates (TAT = Due-Date - Result_Date). The number is calculated and excludes weekends and ideally holidays (for that I have a tblHoliday but not sure how to use...
  6. A

    calculation error

    Public Function fGetWorkdays2(pstart As Date, pend As Date) As Integer ret=0 ' return value, holds weekdays between pstart and pend ret =7 - Weekday(pstart) ' notes about what this line is doing (defines start as Monday-Sunday) ret = ret + 5 * (DateDiff("ww", pstart, pend) - 1)...
  7. A

    calculation error

    Public Function fGetWorkdays2(pstart As Date, pend As Date) As Integer ret=0 ' return value, holds weekdays between pstart and pend ret =7 - Weekday(pstart) ' notes about what this line is doing (defines start as Monday-Sunday) ret = ret + 5 * (DateDiff("ww", pstart, pend) - 1)...
  8. A

    calculation error

    Option Compare Database Public Function fGetWorkdays2(pstart As Date, pend As Date) As Integer fGetWorkdays2 = 7 - Weekday(pstart) + 5 * (DateDiff("ww", pstart, pend) - 1) + Weekday(pend) - 1 End Function then I call the function VB Private Sub Result_Date_AfterUpdate() Me.[TAT] =...
  9. A

    calculation error

    I'm not sure I follow. I'm just trying to calculate the difference from the two dates, excluding weekends and holidays. So, if Due_Date is 9/19/2014 and Result_Date is 9/19/2014, then TAT is 0 if Due_Date is 9/26/2014 and Result_Date is 9/29/2014, then TAT is 1 (the weekend dates are...
  10. A

    calculation error

    They are two seperate fields, Result_Date is a field and Due_Date is a field. Basically I have another field (Text25) which is a calculation of Due_Date-Result_Date. So, the code: Me.[Text25] = GetBusinessDay([Due_Date] - [Result_Date] was my attempt, but it doesn't calculate a date. Here...
  11. A

    calculation error

    Trying to create a calculation in a field (text25) that excludes weekends and holidays. I am getting an argument not optional error. Thanks. Me.[Text25] = GetBusinessDay([Due_Date - Result_Date])
  12. A

    date edit

    Here is the complete code: Private Sub Form_Current() Me.Check275.Visible = Not IsNull(Me.Text246) If Me.Check295 = -1 Then Me.Text281.Visible = True Me.Text285.Visible = True Me.Text287.Visible = True Me.Text289.Visible = True Me.AddDate.Visible =...
  13. A

    date edit

    The control Source is set to AddDate in the field. Thanks.
  14. A

    date edit

    Me.AddDate is bound to a field called AddDate. The problem is if the user check the box the AddDate will be automatically set to 8/22/2014. If the user changes that date manually to 8/11/2014 and goes to the next record the change does not save and AddDate is still 8/22/2014. Thank you.
  15. A

    date edit

    I have a field on a form that when a check box is checked then the date is populate in a AddDate field. The problem is if the user edits that field the changes do not save. Below is some of the code, how do I save the changes? Thanks. Me.AddDate = Date If Me.Dirty Then 'Save any edits...
  16. A

    calculation incorrect

    The amended code did not work when I tried it, so I added some lines back to get most of the db to work. I am learning and hopefully improving in VB, but this is a new problem for me. Thank you.
  17. A

    calculation incorrect

    Is there a way to prevent the Date Received from changing after the Test has been selected? For example, if you type 1 into the HLA ID field Date Received is 8/18/2014, but when a test "LR" is selected it changes to 8/19/2014 (this is correct). If the user meant to select test "HR" instead the...
  18. A

    calculation incorrect

    I can not figure out why in the attached database the Due Date gets calculated incorrectly (off by 1 day). If text is entered into the HLA ID field the Date Received is 8/16/2014. If then in the test dropdown "STR" is selected, the Due Date is calculated to be 8/19/2014 (should be 8/18/2014)...
  19. A

    date format in VBA

    Me.Day_Received = WeekdayName(Weekday(Date)) The above code shows Friday. What is the correct synatx to display: Friday, 8/15/2014? Thank you.
  20. A

    checkbox not saving

    If a checkbox on a form is selected then a few fields are visible. That seems to work, but when the database is closed and re-openend the edits are not saved in the record. The code is below. Thank you. Private Sub Form_Current() Me.Check275.Visible = Not IsNull(Me.Text246) If...
Back
Top Bottom