Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012

    Unanswered: Determining the value of 3 Date/Time Boxes

    I imported a excel spreadsheet into an access datebase and in the excel spreadsheet there are 3 fields that allow the user to click inside the box and add a date (KBtoFirms1_CMAS + KBFirms2_CMAS + KBFirms3_CMAS = BatchKBCount_CMAS_DontTouch). On my form i have added 3 text boxes that allow the user to enter a date. What I am trying to do is assign a value to the fields and when a date is added count that as "1" and when the field is empty count that as "0" then place that value in the BatchKBCount_CMAS_DontTouch. For example if KBtoFirms1_CMAS has a date and KBtoFirms2_CMAS has a date and KBtoFirms3_CMAS does not have a date then the value in BatchKBCount_CMAS_DontTouch should equal "2". Can this be done by code or can i do this by using sometype of forumla in the table and if so how do i accomplish this.

    Thanking you in advance for your help and assistance in this matter.

  2. #2
    Join Date
    Oct 2006
    You indicated you have a form where they enter a date.

    On your KbtoFirms1_CMAS_Afterupdate event you could do the following:

    dim Cnt as integer
    Cnt = 0

    if me.kbtofirms1_cmas > "" then cnt = cnt + 1
    if me.kbtofirms2_cmas > "" then cnt = cnt + 1
    if me.kbtofirms3_cmas > "" then cnt = cnt + 1

    me.BatchKBCount_CMAS_DontTouch = cnt

    Work with that and see what it does.

    Just a tip, try to name fields something that you can recognize. Kbtofirms1_cmas gives me no indication it's a date field. BatchKBCount_CMAS_DontTouch doesn't tell me anything either.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts