Results 1 to 12 of 12
  1. #1
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727

    Expression In Field not calculating until I click somewhere on the form

    Its weird. I just updated to a new laptop and am now running Windows 8.1 but still have the same version of Office (2007). I have this calculation in a field and never had problems with it till now:

    =[Absolute Suspension:]+[To And From Work:]+[Other:]

    This adds up 3 text boxes once values are entered but not its like it does not calculate unless I click somewhere on the form. Doesn't have to be anywhere specific either. I just have to click the form, almost as if to wake it up to calculate and sum up the values.



    Has anyone had this issue before?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Sounds like you have focus in a control that your expression is dependent on.

  3. #3
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Yeah what I found out is that when I fill out a date field that has the calendar icon for you to click on then choose a date, that is when the focus goes off the form or something and even though I tab or enter through the text fields and enter data, the focus does not come back to the form until I actually click somewhere on the form itself. It only happens when I am using my Windows 8.1 laptop. For my XP machine at work and my other Windows 7 laptop, this does not happen. I use microsoft office 2007 on all these operating systems so I know its not the version of office.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe you can use an old school active X date picker so you can keep control via VBA. It is interesting that W7 does not lose focus. I have experience with the intrinsic date picker that is associated with the Date data type not allowing me to .Refresh or .Requery while the user interacts with it in W7 / Access 2010

  5. #5
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Is there VBA that is equal to a click on the mouse? Like I could use VBA to make the mouse click the form after I use the date picker or something? Would you or anyone know how to do that?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    There is the MouseWheel property that is associated with the form level properties.

  7. #7
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    But I don't always use the mouse wheel after filling out the dates or other text boxes. This needs to be something that the user always does to make sure that the macro will take place. This whole thing of the calculation that does not take place once the user uses the date picker will only confuse the user. Right now it looks as if the fields that are supposed to auto fill, are not working when in actuality it is but not till you either click the form or save it. Its very unusual and I would like to fix this if possible.

  8. #8
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Would a requery command fix this?

  9. #9
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    A requery would most likely benefit you but you need an event to fire the code. Where would you put the requery code?

  10. #10
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    I was thinking on the fields that the user will enter data. Maybe on the On Enter event?

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You could use the On Enter. I would use some code to verify there is data in each of the controls before doing the calc.

    If me.Control1 <> "" AND me.Control2 <> "" AND me.Control3 <> "" Then
    Me.UnboundControl =[Absolute Suspension:]+[To And From Work:]+[Other:]
    End if

    Using data validation the above should work if you place it in each of the three controls' After Update events.

  12. #12
    data808 is offline Noob
    Windows 7 32bit Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks for the help. The event I needed to add this was for the On Lost Focus event. Works like a charm now. Thanks again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 09-17-2013, 05:22 PM
  2. Replies: 9
    Last Post: 01-31-2013, 12:55 PM
  3. Form auto enter field on new record click
    By Traceyann in forum Forms
    Replies: 3
    Last Post: 08-18-2012, 08:39 AM
  4. Form Field Not Calculating Properly
    By RMittelman in forum Forms
    Replies: 3
    Last Post: 07-25-2012, 01:05 PM
  5. Replies: 7
    Last Post: 01-12-2011, 08:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums