Results 1 to 9 of 9
  1. #1
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17

    Help with updating IIf from 2000 to 2010

    In access 2000 I built and if statement that would work and calculate a number soon as I entered a number and clicked tab. In 2010 version when I enter in the number and click tab it stays blank, what do I need to tweak in IIf




    IIf([Paw5.Pawn]=1, [AmtFin]*0.25,0)

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Does any VBA code run? Code does not run in 2007/2010 unless your Database resides in a folder that has been declared a “trusted” location.

    To trust your folder, click:
    1. Office Button (top left)
    2. Access Options (bottom of dialog)
    3. Trust Center (left)
    4. Trust Center Settings (button)
    5. Trusted Locations (left)
    6. Add new location (button)

    Here's a visual for it, courtesy of BTAB Development:

    http://www.btabdevelopment.com/ts/de...aspx?PageId=13

    If that doesn't do it, you might check to see if you have a Missing Reference to Windows Common Controls. I have seen a report of this causing this problem, when moving up from previous versions.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17
    Well the vb code works but it doesn't auto fill it in immediately when I click the tab button after entering in the number like previous access 2000 version. If I change records then click back then the data appears. Is there something I need to add so when I put in say 100, the interest field automatically shows 25 after the 100 is entered and tab is clicked?

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Mike4172 View Post
    ...it doesn't auto fill it in immediately when I click the tab button after entering in the number like previous access 2000 version...
    • What 'tab' button are you talking about?
    • Where do you currently have your code?
    • What kind of Field is Pawn defined as, a Number Datatype?

    If your results depends on the Value that is entered in a given Control, place your calculation in the AfterUpdate event of that Control. If I've understood your explanation correctly, and you're talking about

    • Entering the 100 you mentioned in the AmtFin Textbox
    • And the target Field for the calculation results were named InterestField
    • And you only want the calculation done if Pawn = 1


    Code:
    Private Sub AmtFin_AfterUpdate()
     If Me.Pawn = 1 Then
      Me.InterestField = Me.AmtFin * 0.25
     Else
      Me.InterestField = 0
     End If
    End Sub


    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17
    The 'tab' on the keyboard, Say I enter in 100 and then click tab, in previous 2000 version it would update the other column (Interest) by simply putting the above input statement.

    Previously I've done it via "Data --> Control Source --> IIF statement. Now when I do that, it doesn't do it when I tab, it does it after I click back to that record.

    The following code which I adjusted to equal your example works in a way, but when I put in a new record, the new number gets spread to all the interest field. When I put in a new record, I need it to stay that number unless I change that records, Amount Finance.

    Code:
    Private Sub Loan_AfterUpdate()
     If Me.Pawn = 1 Then
      Me.Text107 = Me.Loan * 0.25
     Else
      Me.Text107 = 0
     End If
    
    End Sub

  6. #6
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17
    Defined as Currency

  7. #7
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    In the Lost Focus Event Of the control your talking about add the following statement: me.Refresh This should refresh all of the controls on the form.

  8. #8
    Mike4172 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    17
    Ok thanks Ray, that fixed it for me.

  9. #9
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    You're very welcome

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

Similar Threads

  1. Replies: 0
    Last Post: 02-19-2012, 08:22 AM
  2. Ms 2000
    By gbuck0 in forum Programming
    Replies: 1
    Last Post: 12-29-2011, 12:12 PM
  3. linked table refresh in 2010 not working in 2000
    By bbbeng in forum Import/Export Data
    Replies: 3
    Last Post: 12-20-2011, 01:25 PM
  4. Mixing Access 2000 with Office 2010
    By fiveoaks in forum Access
    Replies: 3
    Last Post: 10-20-2011, 09:59 AM
  5. Opening Access 2000 file in Access 2010
    By Jacob in forum Access
    Replies: 10
    Last Post: 02-12-2011, 06:56 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